All Downloads are FREE. Search and download functionalities are using the official Maven repository.

info.archinnov.achilles.generated.meta.entity.SimpleEntity_AchillesMeta Maven / Gradle / Ivy

package info.archinnov.achilles.generated.meta.entity;

import com.datastax.driver.core.ClusteringOrder;
import com.datastax.driver.core.ConsistencyLevel;
import com.datastax.driver.core.DataType;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import com.google.common.reflect.TypeToken;
import info.archinnov.achilles.generated.function.Date_Type;
import info.archinnov.achilles.generated.function.List_ConsistencyLevel_Type;
import info.archinnov.achilles.generated.function.Long_Type;
import info.archinnov.achilles.generated.function.Map_Integer_String_Type;
import info.archinnov.achilles.generated.function.Set_Double_Type;
import info.archinnov.achilles.generated.function.String_Type;
import info.archinnov.achilles.internals.apt.annotations.AchillesMeta;
import info.archinnov.achilles.internals.codec.EnumNameCodec;
import info.archinnov.achilles.internals.codec.FallThroughCodec;
import info.archinnov.achilles.internals.entities.SimpleEntity;
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.SetProperty;
import info.archinnov.achilles.internals.metamodel.SimpleProperty;
import info.archinnov.achilles.internals.metamodel.columns.ClusteringColumnInfo;
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 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.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;

/**
 * Meta class of all entities of type SimpleEntity
* The meta class is responsible for
*
    *
  • determining runtime consistency levels (read/write,serial)
  • *
  • determining runtime insert strategy
  • *
  • trigger event interceptors (if any)
  • *
  • map a com.datastax.driver.core.Row back to an instance of SimpleEntity
  • *
  • 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 SimpleEntity_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 SimpleEntity 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<>((SimpleEntity entity$) -> entity$.getId(), (SimpleEntity 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 'date' 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 SimpleEntity 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 date = new SimpleProperty(new FieldInfo<>((SimpleEntity entity$) -> entity$.getDate(), (SimpleEntity entity$, Date value$) -> entity$.setDate(value$), "date", "date", ColumnType.CLUSTERING, new ClusteringColumnInfo(1, false, ClusteringOrder.ASC), IndexInfo.noIndex()), DataType.timestamp(), gettableData$ -> gettableData$.get("date", java.util.Date.class), (settableData$, value$) -> settableData$.set("date", value$, java.util.Date.class), new TypeToken(){}, new TypeToken(){}, new FallThroughCodec<>(Date.class)); /** * Meta class for 'value' 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 SimpleEntity 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 value = new SimpleProperty(new FieldInfo<>((SimpleEntity entity$) -> entity$.getValue(), (SimpleEntity entity$, String value$) -> entity$.setValue(value$), "value", "value", ColumnType.NORMAL, new ColumnInfo(false), IndexInfo.noIndex()), DataType.text(), gettableData$ -> gettableData$.get("value", java.lang.String.class), (settableData$, value$) -> settableData$.set("value", value$, java.lang.String.class), new TypeToken(){}, new TypeToken(){}, new FallThroughCodec<>(String.class)); /** * Meta class for 'consistencyList' 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 SimpleEntity 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 consistencyList = new ListProperty<>(new FieldInfo<>((SimpleEntity entity$) -> entity$.getConsistencyList(), (SimpleEntity entity$, List value$) -> entity$.setConsistencyList(value$), "consistencyList", "consistencylist", ColumnType.NORMAL, new ColumnInfo(false), IndexInfo.noIndex()), false, false, String.class, new SimpleProperty(FieldInfo. of("consistencyList", "consistencylist"), DataType.text(), gettable$ -> null, (udt$, value$) -> {}, new TypeToken(){}, new TypeToken(){}, new EnumNameCodec<>(java.util.Arrays.asList(ConsistencyLevel.values()), ConsistencyLevel.class))); /** * Meta class for 'simpleSet' 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 SimpleEntity 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 SetProperty simpleSet = new SetProperty<>(new FieldInfo<>((SimpleEntity entity$) -> entity$.getSimpleSet(), (SimpleEntity entity$, Set value$) -> entity$.setSimpleSet(value$), "simpleSet", "simpleset", ColumnType.NORMAL, new ColumnInfo(false), IndexInfo.noIndex()), false, false, Double.class, new SimpleProperty(FieldInfo. of("simpleSet", "simpleset"), DataType.cdouble(), gettable$ -> null, (udt$, value$) -> {}, new TypeToken(){}, new TypeToken(){}, new FallThroughCodec<>(Double.class))); /** * Meta class for 'simpleMap' 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 SimpleEntity 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 simpleMap = new MapProperty(new FieldInfo<>((SimpleEntity entity$) -> entity$.getSimpleMap(), (SimpleEntity entity$, Map value$) -> entity$.setSimpleMap(value$), "simpleMap", "simplemap", ColumnType.NORMAL, new ColumnInfo(false), IndexInfo.noIndex()), false, false, new SimpleProperty(FieldInfo. of("simpleMap", "simplemap"), DataType.cint(), gettable$ -> null, (udt$, value$) -> {}, new TypeToken(){}, new TypeToken(){}, new FallThroughCodec<>(Integer.class)), new SimpleProperty(FieldInfo. of("simpleMap", "simplemap"), DataType.text(), gettable$ -> null, (udt$, value$) -> {}, new TypeToken(){}, new TypeToken(){}, new FallThroughCodec<>(String.class))); /** * Static class to expose "SimpleEntity_AchillesMeta" fields for type-safe function calls */ public static final SimpleEntity_AchillesMeta.ColumnsForFunctions COLUMNS = new SimpleEntity_AchillesMeta.ColumnsForFunctions(); ; @Override protected Class getEntityClass() { return SimpleEntity.class; } @Override protected String getDerivedTableOrViewName() { return "simpleentity"; } @Override protected BiMap fieldNameToCqlColumn() { BiMap map = HashBiMap.create(6); map.put("id", "id"); map.put("date", "date"); map.put("value", "value"); map.put("consistencyList", "consistencylist"); map.put("simpleSet", "simpleset"); map.put("simpleMap", "simplemap"); 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(date); } @Override protected List> getNormalColumns() { return Arrays.asList(consistencyList,simpleMap,simpleSet,value); } @Override protected List> getComputedColumns() { return Arrays.asList(); } @Override protected boolean isCounterTable() { return false; } @Override protected Optional getStaticKeyspace() { return Optional.empty(); } @Override protected Optional getStaticTableOrViewName() { return Optional.of("simple"); } @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(); } /** * 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 "date" */ public final Date_Type DATE = new Date_Type(Optional.empty()){ @Override protected String cqlColumn() { return "date"; } @Override public boolean isFunctionCall() { return false; } } ; /** *
      * Field to be used for manager.dsl().select().function(...) call *
      * This is an alias for the field "value" */ public final String_Type VALUE = new String_Type(Optional.empty()){ @Override protected String cqlColumn() { return "value"; } @Override public boolean isFunctionCall() { return false; } } ; /** *
      * Field to be used for manager.dsl().select().function(...) call *
      * This is an alias for the field "consistencyList" */ public final List_ConsistencyLevel_Type CONSISTENCY_LIST = new List_ConsistencyLevel_Type(Optional.empty()){ @Override protected String cqlColumn() { return "consistencylist"; } @Override public boolean isFunctionCall() { return false; } } ; /** *
      * Field to be used for manager.dsl().select().function(...) call *
      * This is an alias for the field "simpleSet" */ public final Set_Double_Type SIMPLE_SET = new Set_Double_Type(Optional.empty()){ @Override protected String cqlColumn() { return "simpleset"; } @Override public boolean isFunctionCall() { return false; } } ; /** *
      * Field to be used for manager.dsl().select().function(...) call *
      * This is an alias for the field "simpleMap" */ public final Map_Integer_String_Type SIMPLE_MAP = new Map_Integer_String_Type(Optional.empty()){ @Override protected String cqlColumn() { return "simplemap"; } @Override public boolean isFunctionCall() { return false; } } ; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy