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

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

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

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.Long_Type;
import info.archinnov.achilles.generated.function.String_Type;
import info.archinnov.achilles.internals.apt.annotations.AchillesMeta;
import info.archinnov.achilles.internals.codec.FallThroughCodec;
import info.archinnov.achilles.internals.entities.EntityWithStaticAnnotations;
import info.archinnov.achilles.internals.metamodel.AbstractEntityProperty;
import info.archinnov.achilles.internals.metamodel.AbstractProperty;
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.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.Integer;
import java.lang.Long;
import java.lang.Override;
import java.lang.String;
import java.lang.SuppressWarnings;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;

/**
 * Meta class of all entities of type EntityWithStaticAnnotations
* 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 EntityWithStaticAnnotations
  • *
  • 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 EntityWithStaticAnnotations_AchillesMeta extends AbstractEntityProperty { /** * Meta class for 'partitionKey' 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 EntityWithStaticAnnotations 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 partitionKey = new SimpleProperty(new FieldInfo<>((EntityWithStaticAnnotations entity$) -> entity$.getPartitionKey(), (EntityWithStaticAnnotations entity$, Long value$) -> entity$.setPartitionKey(value$), "partitionKey", "partition_key", ColumnType.PARTITION, new PartitionKeyInfo(1, false), IndexInfo.noIndex()), DataType.bigint(), gettableData$ -> gettableData$.get("partition_key", java.lang.Long.class), (settableData$, value$) -> settableData$.set("partition_key", value$, java.lang.Long.class), new TypeToken(){}, new TypeToken(){}, new FallThroughCodec<>(Long.class)); /** * Meta class for 'stringValue' 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 EntityWithStaticAnnotations 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 stringValue = new SimpleProperty(new FieldInfo<>((EntityWithStaticAnnotations entity$) -> entity$.getStringValue(), (EntityWithStaticAnnotations entity$, String value$) -> entity$.setStringValue(value$), "stringValue", "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 'overridenName' 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 EntityWithStaticAnnotations 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 overridenName = new SimpleProperty(new FieldInfo<>((EntityWithStaticAnnotations entity$) -> entity$.getOverridenName(), (EntityWithStaticAnnotations entity$, String value$) -> entity$.setOverridenName(value$), "overridenName", "overRiden", ColumnType.NORMAL, new ColumnInfo(false), IndexInfo.noIndex()), DataType.text(), gettableData$ -> gettableData$.get("\"overRiden\"", java.lang.String.class), (settableData$, value$) -> settableData$.set("\"overRiden\"", value$, java.lang.String.class), new TypeToken(){}, new TypeToken(){}, new FallThroughCodec<>(String.class)); /** * Static class to expose "EntityWithStaticAnnotations_AchillesMeta" fields for type-safe function calls */ public static final EntityWithStaticAnnotations_AchillesMeta.ColumnsForFunctions COLUMNS = new EntityWithStaticAnnotations_AchillesMeta.ColumnsForFunctions(); ; @Override protected Class getEntityClass() { return EntityWithStaticAnnotations.class; } @Override protected String getDerivedTableOrViewName() { return "entity_with_static_annotations"; } @Override protected BiMap fieldNameToCqlColumn() { BiMap map = HashBiMap.create(3); map.put("partitionKey", "partition_key"); map.put("stringValue", "value"); map.put("overridenName", "\"overRiden\""); return map; } @Override protected Optional getStaticReadConsistency() { return Optional.of(ConsistencyLevel.LOCAL_QUORUM); } @Override protected Optional getStaticNamingStrategy() { return Optional.of(new info.archinnov.achilles.internals.strategy.naming.SnakeCaseNaming()); } @Override protected List> getPartitionKeys() { return Arrays.asList(partitionKey); } @Override protected List> getClusteringColumns() { return Arrays.asList(); } @Override protected List> getNormalColumns() { return Arrays.asList(overridenName,stringValue); } @Override protected List> getComputedColumns() { return Arrays.asList(); } @Override protected boolean isCounterTable() { return false; } @Override protected Optional getStaticKeyspace() { return Optional.of("my_static_keyspace"); } @Override protected Optional getStaticTableOrViewName() { return Optional.of("entity_static_annotations"); } @Override protected Optional getStaticWriteConsistency() { return Optional.of(ConsistencyLevel.LOCAL_ONE); } @Override protected Optional getStaticSerialConsistency() { return Optional.of(ConsistencyLevel.LOCAL_SERIAL); } @Override protected Optional getStaticTTL() { return Optional.of(1); } @Override protected Optional getStaticInsertStrategy() { return Optional.of(InsertStrategy.NOT_NULL_FIELDS); } @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 "partitionKey" */ public final Long_Type PARTITION_KEY = new Long_Type(Optional.empty()){ @Override protected String cqlColumn() { return "partition_key"; } @Override public boolean isFunctionCall() { return false; } } ; /** *
      * Field to be used for manager.dsl().select().function(...) call *
      * This is an alias for the field "stringValue" */ public final String_Type STRING_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 "overridenName" */ public final String_Type OVERRIDEN_NAME = new String_Type(Optional.empty()){ @Override protected String cqlColumn() { return "\"overRiden\""; } @Override public boolean isFunctionCall() { return false; } } ; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy