info.archinnov.achilles.generated.meta.entity.EntityWithComplexCounters_AchillesMeta Maven / Gradle / Ivy
The newest version!
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.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.Long_Type;
import info.archinnov.achilles.generated.function.PartitionKeys_Type;
import info.archinnov.achilles.generated.function.String_Type;
import info.archinnov.achilles.generated.function.UUID_Type;
import info.archinnov.achilles.internals.apt.annotations.AchillesMeta;
import info.archinnov.achilles.internals.codec.FallThroughCodec;
import info.archinnov.achilles.internals.codecs.StringToLongCodec;
import info.archinnov.achilles.internals.entities.EntityWithComplexCounters;
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.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.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.Optional;
import java.util.UUID;
/**
* Meta class of all entities of type EntityWithComplexCounters
* 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 EntityWithComplexCounters
* - 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 EntityWithComplexCounters_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 EntityWithComplexCounters 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<>((EntityWithComplexCounters entity$) -> entity$.getId(), (EntityWithComplexCounters 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 'staticCounter' 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 EntityWithComplexCounters 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 staticCounter = new SimpleProperty(new FieldInfo<>((EntityWithComplexCounters entity$) -> entity$.getStaticCounter(), (EntityWithComplexCounters entity$, Long value$) -> entity$.setStaticCounter(value$), "staticCounter", "static_count", ColumnType.STATIC_COUNTER, new ColumnInfo(false), IndexInfo.noIndex()), DataType.counter(), gettableData$ -> gettableData$.get("static_count", java.lang.Long.class), (settableData$, value$) -> settableData$.set("static_count", value$, java.lang.Long.class), new TypeToken(){}, new TypeToken(){}, new FallThroughCodec<>(Long.class));
/**
* Meta class for 'uuid' 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 EntityWithComplexCounters 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 uuid = new SimpleProperty(new FieldInfo<>((EntityWithComplexCounters entity$) -> entity$.getUuid(), (EntityWithComplexCounters entity$, UUID value$) -> entity$.setUuid(value$), "uuid", "uuid", ColumnType.CLUSTERING, new ClusteringColumnInfo(1, false, ClusteringOrder.ASC), IndexInfo.noIndex()), DataType.uuid(), gettableData$ -> gettableData$.get("uuid", java.util.UUID.class), (settableData$, value$) -> settableData$.set("uuid", value$, java.util.UUID.class), new TypeToken(){}, new TypeToken(){}, new FallThroughCodec<>(UUID.class));
/**
* Meta class for 'simpleCounter' 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 EntityWithComplexCounters 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 simpleCounter = new SimpleProperty(new FieldInfo<>((EntityWithComplexCounters entity$) -> entity$.getSimpleCounter(), (EntityWithComplexCounters entity$, Long value$) -> entity$.setSimpleCounter(value$), "simpleCounter", "count", ColumnType.COUNTER, new ColumnInfo(false), IndexInfo.noIndex()), DataType.counter(), gettableData$ -> gettableData$.get("count", long.class), (settableData$, value$) -> settableData$.set("count", value$, long.class), new TypeToken(){}, new TypeToken(){}, new FallThroughCodec<>(Long.class));
/**
* Meta class for 'counterWithCodec' 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 EntityWithComplexCounters 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 counterWithCodec = new SimpleProperty(new FieldInfo<>((EntityWithComplexCounters entity$) -> entity$.getCounterWithCodec(), (EntityWithComplexCounters entity$, String value$) -> entity$.setCounterWithCodec(value$), "counterWithCodec", "codec_count", ColumnType.COUNTER, new ColumnInfo(false), IndexInfo.noIndex()), DataType.counter(), gettableData$ -> gettableData$.get("codec_count", java.lang.Long.class), (settableData$, value$) -> settableData$.set("codec_count", value$, java.lang.Long.class), new TypeToken(){}, new TypeToken(){}, new StringToLongCodec());
/**
* Static class to expose "EntityWithComplexCounters_AchillesMeta" fields for type-safe function calls */
public static final EntityWithComplexCounters_AchillesMeta.ColumnsForFunctions COLUMNS = new EntityWithComplexCounters_AchillesMeta.ColumnsForFunctions();
;
@Override
protected Class getEntityClass() {
return EntityWithComplexCounters.class;
}
@Override
protected String getDerivedTableOrViewName() {
return "entitywithcomplexcounters";
}
@Override
protected BiMap fieldNameToCqlColumn() {
BiMap map = HashBiMap.create(5);
map.put("id", "id");
map.put("staticCounter", "static_count");
map.put("uuid", "uuid");
map.put("simpleCounter", "count");
map.put("counterWithCodec", "codec_count");
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(uuid);
}
@Override
protected List> getNormalColumns() {
return Arrays.asList();
}
@Override
protected List> getComputedColumns() {
return Arrays.asList();
}
@Override
protected List> getConstructorInjectedColumns() {
return Arrays.asList();
}
@Override
protected boolean isCounterTable() {
return true;
}
@Override
protected Optional getStaticKeyspace() {
return Optional.empty();
}
@Override
protected Optional getStaticTableOrViewName() {
return Optional.of("entity_complex_counters");
}
@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(staticCounter);
}
@Override
protected List> getCounterColumns() {
return Arrays.asList(counterWithCodec,simpleCounter);
}
@Override
protected EntityWithComplexCounters newInstanceFromCustomConstructor(final Row row, final List cqlColumns) {
throw new UnsupportedOperationException("Cannot instantiate entity 'info.archinnov.achilles.internals.entities.EntityWithComplexCounters' 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 "staticCounter" */
public final Long_Type STATIC_COUNTER = new Long_Type(Optional.empty()){
@Override
protected String cqlColumn() {
return "static_count";
}
@Override
public boolean isFunctionCall() {
return false;
}
}
;
/**
*
* Field to be used for manager.dsl().select().function(...) call
*
* This is an alias for the field "uuid" */
public final UUID_Type UUID = new UUID_Type(Optional.empty()){
@Override
protected String cqlColumn() {
return "uuid";
}
@Override
public boolean isFunctionCall() {
return false;
}
}
;
/**
*
* Field to be used for manager.dsl().select().function(...) call
*
* This is an alias for the field "simpleCounter" */
public final Long_Type SIMPLE_COUNTER = new Long_Type(Optional.empty()){
@Override
protected String cqlColumn() {
return "count";
}
@Override
public boolean isFunctionCall() {
return false;
}
}
;
/**
*
* Field to be used for manager.dsl().select().function(...) call
*
* This is an alias for the field "counterWithCodec" */
public final String_Type COUNTER_WITH_CODEC = new String_Type(Optional.empty()){
@Override
protected String cqlColumn() {
return "codec_count";
}
@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