Skip to content

Commit

Permalink
feat: update cassandra udt removing the udt annotation
Browse files Browse the repository at this point in the history
Signed-off-by: Otavio Santana <otaviopolianasantana@gmail.com>
  • Loading branch information
otaviojava committed Mar 12, 2024
1 parent 3de1a12 commit ccc3a7e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ protected Converters converters() {
protected <T> Consumer<String> feedObject(T instance, List<Element> columns, Map<String, FieldMetadata> fieldsGroupByName) {
return k -> {
FieldMetadata field = fieldsGroupByName.get(k);
if (field.value(UDT.class).isPresent()) {
if (field.udt().isPresent()) {
Optional<Element> column = columns.stream().filter(c -> c.name().equals(k)).findFirst();
setUDTField(instance, column, field);
} else {
Expand Down Expand Up @@ -93,7 +93,7 @@ private <T> void setUDTField(T instance, Optional<Element> column, FieldMetadata
protected AttributeFieldValue to(FieldMetadata field, Object entityInstance) {

Object value = field.read(entityInstance);
Optional<String> annotation = field.value(UDT.class);
Optional<String> annotation = field.udt();
return annotation.<AttributeFieldValue>map(v -> new CassandraUDTType(v, value, field))
.orElseGet( () -> super.to(field, entityInstance));
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ public class Person {
@Column
private Integer age;

@UDT("address")
@Column
@Column(udt = "address")
private Address home;

public String getName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import jakarta.nosql.Column;
import jakarta.nosql.Entity;
import jakarta.nosql.Id;
import org.eclipse.jnosql.databases.cassandra.mapping.UDT;

import java.util.List;
import java.util.Objects;
Expand All @@ -29,8 +28,7 @@ public class AppointmentBook {
private String user;


@Column
@UDT("Contact")
@Column(udt = "Contact")
private List<Contact> contacts;


Expand Down Expand Up @@ -69,9 +67,9 @@ public int hashCode() {

@Override
public String toString() {
String sb = "AppointmentBook{" + "user='" + user + '\'' +
return "AppointmentBook{" +
"user='" + user + '\'' +
", contacts=" + contacts +
'}';
return sb;
}
}

0 comments on commit ccc3a7e

Please sign in to comment.