![JAR search and dependency download from the Maven repository](/logo.png)
info.archinnov.achilles.generated.meta.udt.TestUDT_AchillesMeta Maven / Gradle / Ivy
package info.archinnov.achilles.generated.meta.udt;
import com.datastax.driver.core.DataType;
import com.datastax.driver.core.UDTValue;
import com.fasterxml.jackson.databind.type.SimpleType;
import com.google.common.reflect.TypeToken;
import info.archinnov.achilles.internals.codec.FallThroughCodec;
import info.archinnov.achilles.internals.codec.JSONCodec;
import info.archinnov.achilles.internals.entities.TestUDT;
import info.archinnov.achilles.internals.metamodel.AbstractProperty;
import info.archinnov.achilles.internals.metamodel.AbstractUDTClassProperty;
import info.archinnov.achilles.internals.metamodel.ListProperty;
import info.archinnov.achilles.internals.metamodel.MapProperty;
import info.archinnov.achilles.internals.metamodel.SimpleProperty;
import info.archinnov.achilles.internals.metamodel.columns.ColumnInfo;
import info.archinnov.achilles.internals.metamodel.columns.ColumnType;
import info.archinnov.achilles.internals.metamodel.columns.FieldInfo;
import info.archinnov.achilles.internals.metamodel.index.IndexInfo;
import info.archinnov.achilles.internals.strategy.naming.InternalNamingStrategy;
import java.lang.Class;
import java.lang.Integer;
import java.lang.Override;
import java.lang.String;
import java.lang.SuppressWarnings;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Optional;
public final class TestUDT_AchillesMeta extends AbstractUDTClassProperty {
/**
* Meta class for 'name' property
* The meta class exposes some useful methods:
* - encodeFromJava: encode a property from raw Java to CQL java compatible type
* - encodeField: extract the current property value from the given TestUDT instance and encode to CQL java compatible type
* - decodeFromGettable: decode from a {@link com.datastax.driver.core.GettableData} instance (Row, UDTValue, TupleValue) the current property
*
*/
@SuppressWarnings({"serial", "unchecked"})
public static final SimpleProperty name = new SimpleProperty(new FieldInfo<>((TestUDT entity$) -> entity$.getName(), (TestUDT entity$, String value$) -> entity$.setName(value$), "name", "name", ColumnType.NORMAL, new ColumnInfo(false), IndexInfo.noIndex()), DataType.text(), gettableData$ -> gettableData$.get("name", java.lang.String.class), (settableData$, value$) -> settableData$.set("name", value$, java.lang.String.class), new TypeToken(){}, new TypeToken(){}, new FallThroughCodec<>(String.class));
/**
* Meta class for 'list' property
* The meta class exposes some useful methods:
* - encodeFromJava: encode a property from raw Java to CQL java compatible type
* - encodeField: extract the current property value from the given TestUDT instance and encode to CQL java compatible type
* - decodeFromGettable: decode from a {@link com.datastax.driver.core.GettableData} instance (Row, UDTValue, TupleValue) the current property
*
*/
@SuppressWarnings({"serial", "unchecked"})
public static final ListProperty list = new ListProperty<>(new FieldInfo<>((TestUDT entity$) -> entity$.getList(), (TestUDT entity$, List value$) -> entity$.setList(value$), "list", "list", ColumnType.NORMAL, new ColumnInfo(false), IndexInfo.noIndex()), false, false, String.class, new SimpleProperty(FieldInfo. of("list", "list"), DataType.text(), gettable$ -> null, (udt$, value$) -> {}, new TypeToken(){}, new TypeToken(){}, new FallThroughCodec<>(String.class)));
/**
* Meta class for 'map' property
* The meta class exposes some useful methods:
* - encodeFromJava: encode a property from raw Java to CQL java compatible type
* - encodeField: extract the current property value from the given TestUDT instance and encode to CQL java compatible type
* - decodeFromGettable: decode from a {@link com.datastax.driver.core.GettableData} instance (Row, UDTValue, TupleValue) the current property
*
*/
@SuppressWarnings({"serial", "unchecked"})
public static final MapProperty map = new MapProperty(new FieldInfo<>((TestUDT entity$) -> entity$.getMap(), (TestUDT entity$, Map value$) -> entity$.setMap(value$), "map", "map", ColumnType.NORMAL, new ColumnInfo(false), IndexInfo.noIndex()), false, false, new SimpleProperty(FieldInfo. of("map", "map"), DataType.text(), gettable$ -> null, (udt$, value$) -> {}, new TypeToken(){}, new TypeToken(){}, new JSONCodec<>(Integer.class, SimpleType.construct(Integer.class))), new SimpleProperty(FieldInfo. of("map", "map"), DataType.text(), gettable$ -> null, (udt$, value$) -> {}, new TypeToken(){}, new TypeToken(){}, new FallThroughCodec<>(String.class)));
public static final TestUDT_AchillesMeta INSTANCE = new TestUDT_AchillesMeta();
@Override
protected Optional getStaticKeyspace() {
return Optional.of("achilles_embedded");
}
@Override
protected Optional getStaticUdtName() {
return Optional.of("my_type");
}
@Override
protected Optional getStaticNamingStrategy() {
return Optional.empty();
}
@Override
protected String getUdtName() {
return "my_type";
}
@Override
protected Class getUdtClass() {
return TestUDT.class;
}
@Override
protected List> getComponentsProperty() {
return Arrays.asList(name, list, map);
}
@Override
protected UDTValue createUDTFromBean(TestUDT instance) {
final UDTValue udtValue = userType.newValue();
name.encodeFieldToUdt(instance, udtValue);
list.encodeFieldToUdt(instance, udtValue);
map.encodeFieldToUdt(instance, udtValue);
return udtValue;
}
@Override
protected TestUDT createBeanFromUDT(UDTValue udtValue) {
final TestUDT instance = udtFactory.newInstance(udtClass);
name.decodeField(udtValue, instance);
list.decodeField(udtValue, instance);
map.decodeField(udtValue, instance);
return instance;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy