info.archinnov.achilles.generated.meta.entity.EntityWithUDTs_AchillesMeta Maven / Gradle / Ivy
The newest version!
package info.archinnov.achilles.generated.meta.entity;
import com.datastax.driver.core.ConsistencyLevel;
import com.datastax.driver.core.DataType;
import com.datastax.driver.core.Row;
import com.datastax.driver.core.UDTValue;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import com.google.common.reflect.TypeToken;
import info.archinnov.achilles.generated.function.List_SimpleUDTWithNoKeyspace_Type;
import info.archinnov.achilles.generated.function.Long_Type;
import info.archinnov.achilles.generated.function.Map_SimpleUDTWithNoKeyspace_SimpleUDTWithNoKeyspace_Type;
import info.archinnov.achilles.generated.function.Optional_SimpleUDTWithNoKeyspace_Type;
import info.archinnov.achilles.generated.function.PartitionKeys_Type;
import info.archinnov.achilles.generated.function.Set_SimpleUDTWithNoKeyspace_Type;
import info.archinnov.achilles.generated.function.Tuple2_Integer_SimpleUDTWithNoKeyspace_Type;
import info.archinnov.achilles.generated.meta.udt.SimpleUDTWithNoKeyspace_AchillesMeta;
import info.archinnov.achilles.internals.apt.annotations.AchillesMeta;
import info.archinnov.achilles.internals.codec.FallThroughCodec;
import info.archinnov.achilles.internals.entities.EntityWithUDTs;
import info.archinnov.achilles.internals.entities.SimpleUDTWithNoKeyspace;
import info.archinnov.achilles.internals.metamodel.AbstractEntityProperty;
import info.archinnov.achilles.internals.metamodel.AbstractProperty;
import info.archinnov.achilles.internals.metamodel.JdkOptionalProperty;
import info.archinnov.achilles.internals.metamodel.ListProperty;
import info.archinnov.achilles.internals.metamodel.MapProperty;
import info.archinnov.achilles.internals.metamodel.SetProperty;
import info.archinnov.achilles.internals.metamodel.SimpleProperty;
import info.archinnov.achilles.internals.metamodel.Tuple2Property;
import info.archinnov.achilles.internals.metamodel.UDTProperty;
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.columns.PartitionKeyInfo;
import info.archinnov.achilles.internals.metamodel.index.IndexInfo;
import info.archinnov.achilles.internals.strategy.naming.InternalNamingStrategy;
import info.archinnov.achilles.type.strategy.InsertStrategy;
import info.archinnov.achilles.type.tuples.Tuple2;
import java.lang.Class;
import java.lang.Integer;
import java.lang.Long;
import java.lang.Override;
import java.lang.String;
import java.lang.SuppressWarnings;
import java.lang.UnsupportedOperationException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
/**
* Meta class of all entities of type EntityWithUDTs
* The meta class is responsible for
*
* - determining runtime consistency levels (read/write,serial)
* - determining runtime insert strategy
* - trigger event interceptors (if any)
* - map a Row back to an instance of EntityWithUDTs
* - determine runtime keyspace name using static annotations and runtime SchemaNameProvider (if any)
* - determine runtime table name using static annotations and runtime SchemaNameProvider (if any)
* - generate schema during bootstrap
* - validate schema during bootstrap
* - expose all property meta classes for encoding/decoding purpose on unitary columns
*
*/
@AchillesMeta
public final class EntityWithUDTs_AchillesMeta extends AbstractEntityProperty {
/**
* Meta class for 'id' 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 EntityWithUDTs 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 id = new SimpleProperty(new FieldInfo<>((EntityWithUDTs entity$) -> entity$.getId(), (EntityWithUDTs entity$, Long value$) -> entity$.setId(value$), "id", "id", ColumnType.PARTITION, new PartitionKeyInfo(1, false), IndexInfo.noIndex()), DataType.bigint(), gettableData$ -> gettableData$.get("id", java.lang.Long.class), (settableData$, value$) -> settableData$.set("id", value$, java.lang.Long.class), new TypeToken(){}, new TypeToken(){}, new FallThroughCodec<>(Long.class));
/**
* Meta class for 'listUDT' 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 EntityWithUDTs 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("unchecked")
public static final ListProperty listUDT = new ListProperty<>(new FieldInfo<>((EntityWithUDTs entity$) -> entity$.getListUDT(), (EntityWithUDTs entity$, List value$) -> entity$.setListUDT(value$), "listUDT", "listudt", ColumnType.NORMAL, new ColumnInfo(false), IndexInfo.noIndex()), false, false, UDTValue.class, new UDTProperty(FieldInfo. of("listUDT", "listudt", true), SimpleUDTWithNoKeyspace.class, SimpleUDTWithNoKeyspace_AchillesMeta.INSTANCE));
/**
* Meta class for 'setUDT' 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 EntityWithUDTs 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("unchecked")
public static final SetProperty setUDT = new SetProperty<>(new FieldInfo<>((EntityWithUDTs entity$) -> entity$.getSetUDT(), (EntityWithUDTs entity$, Set value$) -> entity$.setSetUDT(value$), "setUDT", "setudt", ColumnType.NORMAL, new ColumnInfo(false), IndexInfo.noIndex()), false, false, UDTValue.class, new UDTProperty(FieldInfo. of("setUDT", "setudt", true), SimpleUDTWithNoKeyspace.class, SimpleUDTWithNoKeyspace_AchillesMeta.INSTANCE));
/**
* Meta class for 'mapUDT' 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 EntityWithUDTs 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("unchecked")
public static final MapProperty mapUDT = new MapProperty(new FieldInfo<>((EntityWithUDTs entity$) -> entity$.getMapUDT(), (EntityWithUDTs entity$, Map value$) -> entity$.setMapUDT(value$), "mapUDT", "mapudt", ColumnType.NORMAL, new ColumnInfo(false), IndexInfo.noIndex()), false, false, new UDTProperty(FieldInfo. of("mapUDT", "mapudt", true), SimpleUDTWithNoKeyspace.class, SimpleUDTWithNoKeyspace_AchillesMeta.INSTANCE), new UDTProperty(FieldInfo. of("mapUDT", "mapudt", true), SimpleUDTWithNoKeyspace.class, SimpleUDTWithNoKeyspace_AchillesMeta.INSTANCE));
/**
* Meta class for 'optionalUDT' 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 EntityWithUDTs 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("unchecked")
public static final JdkOptionalProperty optionalUDT = new JdkOptionalProperty<>(new FieldInfo<>((EntityWithUDTs entity$) -> entity$.getOptionalUDT(), (EntityWithUDTs entity$, Optional value$) -> entity$.setOptionalUDT(value$), "optionalUDT", "optionaludt", ColumnType.NORMAL, new ColumnInfo(false), IndexInfo.noIndex()), new UDTProperty(FieldInfo. of("optionaludt", "optionalUDT", false), SimpleUDTWithNoKeyspace.class, SimpleUDTWithNoKeyspace_AchillesMeta.INSTANCE));
/**
* Meta class for 'tupleUDT' 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 EntityWithUDTs 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 Tuple2Property tupleUDT = new Tuple2Property<>(new FieldInfo<>((EntityWithUDTs entity$) -> entity$.getTupleUDT(), (EntityWithUDTs entity$, Tuple2 value$) -> entity$.setTupleUDT(value$), "tupleUDT", "tupleudt", ColumnType.NORMAL, new ColumnInfo(false), IndexInfo.noIndex()), new SimpleProperty(FieldInfo. of("tupleUDT", "tupleudt", true), DataType.cint(), gettable$ -> null, (udt$, value$) -> {}, new TypeToken(){}, new TypeToken(){}, new FallThroughCodec<>(Integer.class)), new UDTProperty(FieldInfo. of("tupleUDT", "tupleudt", true), SimpleUDTWithNoKeyspace.class, SimpleUDTWithNoKeyspace_AchillesMeta.INSTANCE));
/**
* Static class to expose "EntityWithUDTs_AchillesMeta" fields for type-safe function calls */
public static final EntityWithUDTs_AchillesMeta.ColumnsForFunctions COLUMNS = new EntityWithUDTs_AchillesMeta.ColumnsForFunctions();
;
@Override
protected Class getEntityClass() {
return EntityWithUDTs.class;
}
@Override
protected String getDerivedTableOrViewName() {
return "entitywithudts";
}
@Override
protected BiMap fieldNameToCqlColumn() {
BiMap map = HashBiMap.create(6);
map.put("id", "id");
map.put("listUDT", "listudt");
map.put("setUDT", "setudt");
map.put("mapUDT", "mapudt");
map.put("optionalUDT", "optionaludt");
map.put("tupleUDT", "tupleudt");
return map;
}
@Override
protected Optional getStaticReadConsistency() {
return Optional.empty();
}
@Override
protected Optional getStaticNamingStrategy() {
return Optional.empty();
}
@Override
protected List> getPartitionKeys() {
return Arrays.asList(id);
}
@Override
protected List> getClusteringColumns() {
return Arrays.asList();
}
@Override
protected List> getNormalColumns() {
return Arrays.asList(listUDT,mapUDT,optionalUDT,setUDT,tupleUDT);
}
@Override
protected List> getComputedColumns() {
return Arrays.asList();
}
@Override
protected List> getConstructorInjectedColumns() {
return Arrays.asList();
}
@Override
protected boolean isCounterTable() {
return false;
}
@Override
protected Optional getStaticKeyspace() {
return Optional.empty();
}
@Override
protected Optional getStaticTableOrViewName() {
return Optional.of("entity_with_udts");
}
@Override
protected Optional getStaticWriteConsistency() {
return Optional.empty();
}
@Override
protected Optional getStaticSerialConsistency() {
return Optional.empty();
}
@Override
protected Optional getStaticTTL() {
return Optional.empty();
}
@Override
protected Optional getStaticInsertStrategy() {
return Optional.empty();
}
@Override
protected List> getStaticColumns() {
return Arrays.asList();
}
@Override
protected List> getCounterColumns() {
return Arrays.asList();
}
@Override
protected EntityWithUDTs newInstanceFromCustomConstructor(final Row row, final List cqlColumns) {
throw new UnsupportedOperationException("Cannot instantiate entity 'info.archinnov.achilles.internals.entities.EntityWithUDTs' using custom constructor because no custom constructor (@EntityCreator) is defined");
}
/**
* Utility class to expose all fields with their CQL type for function call */
public static final class ColumnsForFunctions {
/**
*
* Field to be used for manager.dsl().select().function(...) call
*
* This is an alias for the field "id" */
public final Long_Type ID = new Long_Type(Optional.empty()){
@Override
protected String cqlColumn() {
return "id";
}
@Override
public boolean isFunctionCall() {
return false;
}
}
;
/**
*
* Field to be used for manager.dsl().select().function(...) call
*
* This is an alias for the field "listUDT" */
public final List_SimpleUDTWithNoKeyspace_Type LIST_UDT = new List_SimpleUDTWithNoKeyspace_Type(Optional.empty()){
@Override
protected String cqlColumn() {
return "listudt";
}
@Override
public boolean isFunctionCall() {
return false;
}
}
;
/**
*
* Field to be used for manager.dsl().select().function(...) call
*
* This is an alias for the field "setUDT" */
public final Set_SimpleUDTWithNoKeyspace_Type SET_UDT = new Set_SimpleUDTWithNoKeyspace_Type(Optional.empty()){
@Override
protected String cqlColumn() {
return "setudt";
}
@Override
public boolean isFunctionCall() {
return false;
}
}
;
/**
*
* Field to be used for manager.dsl().select().function(...) call
*
* This is an alias for the field "mapUDT" */
public final Map_SimpleUDTWithNoKeyspace_SimpleUDTWithNoKeyspace_Type MAP_UDT = new Map_SimpleUDTWithNoKeyspace_SimpleUDTWithNoKeyspace_Type(Optional.empty()){
@Override
protected String cqlColumn() {
return "mapudt";
}
@Override
public boolean isFunctionCall() {
return false;
}
}
;
/**
*
* Field to be used for manager.dsl().select().function(...) call
*
* This is an alias for the field "optionalUDT" */
public final Optional_SimpleUDTWithNoKeyspace_Type OPTIONAL_UDT = new Optional_SimpleUDTWithNoKeyspace_Type(Optional.empty()){
@Override
protected String cqlColumn() {
return "optionaludt";
}
@Override
public boolean isFunctionCall() {
return false;
}
}
;
/**
*
* Field to be used for manager.dsl().select().function(...) call
*
* This is an alias for the field "tupleUDT" */
public final Tuple2_Integer_SimpleUDTWithNoKeyspace_Type TUPLE_UDT = new Tuple2_Integer_SimpleUDTWithNoKeyspace_Type(Optional.empty()){
@Override
protected String cqlColumn() {
return "tupleudt";
}
@Override
public boolean isFunctionCall() {
return false;
}
}
;
/**
*
* Field to be used with SystemFunctions.token(xxx_AchillesMeta.COLUMNS.PARTITION_KEYS, "tokens") call
*
*/
public final PartitionKeys_Type PARTITION_KEYS = new PartitionKeys_Type(new ArrayList() {
{
add("id"); }
})
;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy