info.archinnov.achilles.generated.meta.entity.EntityWithNativeCollections_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.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import com.google.common.reflect.TypeToken;
import info.archinnov.achilles.generated.function.List_Double_Type;
import info.archinnov.achilles.generated.function.List_Long_Type;
import info.archinnov.achilles.generated.function.Long_Type;
import info.archinnov.achilles.generated.function.Map_Integer_Long_Type;
import info.archinnov.achilles.generated.function.PartitionKeys_Type;
import info.archinnov.achilles.generated.function.Tuple2_List_Integer_List_Double_Type;
import info.archinnov.achilles.internals.apt.annotations.AchillesMeta;
import info.archinnov.achilles.internals.codec.FallThroughCodec;
import info.archinnov.achilles.internals.entities.EntityWithNativeCollections;
import info.archinnov.achilles.internals.metamodel.AbstractEntityProperty;
import info.archinnov.achilles.internals.metamodel.AbstractProperty;
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.Tuple2Property;
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.Double;
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;
/**
* Meta class of all entities of type EntityWithNativeCollections
* 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 EntityWithNativeCollections
* - 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 EntityWithNativeCollections_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 EntityWithNativeCollections 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<>((EntityWithNativeCollections entity$) -> entity$.getId(), (EntityWithNativeCollections 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 'longList' 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 EntityWithNativeCollections 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 longList = new ListProperty<>(new FieldInfo<>((EntityWithNativeCollections entity$) -> entity$.getLongList(), (EntityWithNativeCollections entity$, List value$) -> entity$.setLongList(value$), "longList", "longlist", ColumnType.NORMAL, new ColumnInfo(false), IndexInfo.noIndex()), false, false, Long.class, new SimpleProperty(FieldInfo. of("longList", "longlist", true), DataType.bigint(), gettable$ -> null, (udt$, value$) -> {}, new TypeToken(){}, new TypeToken(){}, new FallThroughCodec<>(Long.class)));
/**
* Meta class for 'doubleList' 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 EntityWithNativeCollections 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 doubleList = new ListProperty<>(new FieldInfo<>((EntityWithNativeCollections entity$) -> entity$.getDoubleList(), (EntityWithNativeCollections entity$, List value$) -> entity$.setDoubleList(value$), "doubleList", "doublelist", ColumnType.NORMAL, new ColumnInfo(false), IndexInfo.noIndex()), false, false, Double.class, new SimpleProperty(FieldInfo. of("doubleList", "doublelist", true), DataType.cdouble(), gettable$ -> null, (udt$, value$) -> {}, new TypeToken(){}, new TypeToken(){}, new FallThroughCodec<>(Double.class)));
/**
* Meta class for 'mapIntLong' 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 EntityWithNativeCollections 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 mapIntLong = new MapProperty(new FieldInfo<>((EntityWithNativeCollections entity$) -> entity$.getMapIntLong(), (EntityWithNativeCollections entity$, Map value$) -> entity$.setMapIntLong(value$), "mapIntLong", "mapintlong", ColumnType.NORMAL, new ColumnInfo(false), IndexInfo.noIndex()), false, false, new SimpleProperty(FieldInfo. of("mapIntLong", "mapintlong", true), DataType.cint(), gettable$ -> null, (udt$, value$) -> {}, new TypeToken(){}, new TypeToken(){}, new FallThroughCodec<>(Integer.class)), new SimpleProperty(FieldInfo. of("mapIntLong", "mapintlong", true), DataType.bigint(), gettable$ -> null, (udt$, value$) -> {}, new TypeToken(){}, new TypeToken(){}, new FallThroughCodec<>(Long.class)));
/**
* Meta class for 'tuple2' 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 EntityWithNativeCollections 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, List> tuple2 = new Tuple2Property<>(new FieldInfo<>((EntityWithNativeCollections entity$) -> entity$.getTuple2(), (EntityWithNativeCollections entity$, Tuple2, List> value$) -> entity$.setTuple2(value$), "tuple2", "tuple2", ColumnType.NORMAL, new ColumnInfo(false), IndexInfo.noIndex()), new ListProperty<>(FieldInfo.> of("tuple2", "tuple2", true), false, false, Integer.class, new SimpleProperty(FieldInfo. of("tuple2", "tuple2", true), DataType.cint(), gettable$ -> null, (udt$, value$) -> {}, new TypeToken(){}, new TypeToken(){}, new FallThroughCodec<>(Integer.class))), new ListProperty<>(FieldInfo.> of("tuple2", "tuple2", true), false, false, Double.class, new SimpleProperty(FieldInfo. of("tuple2", "tuple2", true), DataType.cdouble(), gettable$ -> null, (udt$, value$) -> {}, new TypeToken(){}, new TypeToken(){}, new FallThroughCodec<>(Double.class))));
/**
* Static class to expose "EntityWithNativeCollections_AchillesMeta" fields for type-safe function calls */
public static final EntityWithNativeCollections_AchillesMeta.ColumnsForFunctions COLUMNS = new EntityWithNativeCollections_AchillesMeta.ColumnsForFunctions();
;
@Override
protected Class getEntityClass() {
return EntityWithNativeCollections.class;
}
@Override
protected String getDerivedTableOrViewName() {
return "entitywithnativecollections";
}
@Override
protected BiMap fieldNameToCqlColumn() {
BiMap map = HashBiMap.create(5);
map.put("id", "id");
map.put("longList", "longlist");
map.put("doubleList", "doublelist");
map.put("mapIntLong", "mapintlong");
map.put("tuple2", "tuple2");
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(doubleList,longList,mapIntLong,tuple2);
}
@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_native_collections");
}
@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 EntityWithNativeCollections newInstanceFromCustomConstructor(final Row row, final List cqlColumns) {
throw new UnsupportedOperationException("Cannot instantiate entity 'info.archinnov.achilles.internals.entities.EntityWithNativeCollections' 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 "longList" */
public final List_Long_Type LONG_LIST = new List_Long_Type(Optional.empty()){
@Override
protected String cqlColumn() {
return "longlist";
}
@Override
public boolean isFunctionCall() {
return false;
}
}
;
/**
*
* Field to be used for manager.dsl().select().function(...) call
*
* This is an alias for the field "doubleList" */
public final List_Double_Type DOUBLE_LIST = new List_Double_Type(Optional.empty()){
@Override
protected String cqlColumn() {
return "doublelist";
}
@Override
public boolean isFunctionCall() {
return false;
}
}
;
/**
*
* Field to be used for manager.dsl().select().function(...) call
*
* This is an alias for the field "mapIntLong" */
public final Map_Integer_Long_Type MAP_INT_LONG = new Map_Integer_Long_Type(Optional.empty()){
@Override
protected String cqlColumn() {
return "mapintlong";
}
@Override
public boolean isFunctionCall() {
return false;
}
}
;
/**
*
* Field to be used for manager.dsl().select().function(...) call
*
* This is an alias for the field "tuple2" */
public final Tuple2_List_Integer_List_Double_Type TUPLE_2 = new Tuple2_List_Integer_List_Double_Type(Optional.empty()){
@Override
protected String cqlColumn() {
return "tuple2";
}
@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