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

info.archinnov.achilles.generated.meta.udt.ImmutableUDT_AchillesMeta Maven / Gradle / Ivy

The newest version!
package info.archinnov.achilles.generated.meta.udt;

import com.datastax.driver.core.DataType;
import com.datastax.driver.core.UDTValue;
import com.datastax.driver.core.UserType;
import com.google.common.reflect.TypeToken;
import info.archinnov.achilles.internals.codec.FallThroughCodec;
import info.archinnov.achilles.internals.entities.ImmutableEntity;
import info.archinnov.achilles.internals.entities.ImmutableUDT;
import info.archinnov.achilles.internals.metamodel.AbstractProperty;
import info.archinnov.achilles.internals.metamodel.AbstractUDTClassProperty;
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.index.IndexInfo;
import info.archinnov.achilles.internals.options.CassandraOptions;
import info.archinnov.achilles.internals.strategy.naming.InternalNamingStrategy;
import java.lang.Class;
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;

public final class ImmutableUDT_AchillesMeta extends AbstractUDTClassProperty {
  /**
   * Meta class for 'idx' 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 ImmutableUDT 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 idx = new SimpleProperty(new FieldInfo<>((ImmutableUDT entity$) -> entity$.idx, (ImmutableUDT entity$, Long value$) -> {}, "idx", "idx", ColumnType.NORMAL, new ColumnInfo(false), IndexInfo.noIndex()), DataType.bigint(), gettableData$ -> gettableData$.get("idx", java.lang.Long.class), (settableData$, value$) -> settableData$.set("idx", value$, java.lang.Long.class), new TypeToken(){}, new TypeToken(){}, new FallThroughCodec<>(Long.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 ImmutableUDT 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<>((ImmutableUDT entity$) -> entity$.value, (ImmutableUDT entity$, String 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)); public static final ImmutableUDT_AchillesMeta INSTANCE = new ImmutableUDT_AchillesMeta(); @Override protected Optional getStaticKeyspace() { return Optional.empty(); } @Override protected Optional getStaticUdtName() { return Optional.of("immutable_udt"); } @Override protected Optional getStaticNamingStrategy() { return Optional.empty(); } @Override protected String getUdtName() { return "immutable_udt"; } @Override protected Class getUdtClass() { return ImmutableUDT.class; } @Override protected Class getParentEntityClass() { return ImmutableEntity.class; } @Override protected List> getComponentsProperty() { return Arrays.asList(idx, value); } @Override protected List> getConstructorInjectedProperty() { return Arrays.asList(idx, value); } @Override protected UDTValue createUDTFromBean(ImmutableUDT instance, boolean frozen, Optional cassandraOptions) { final UserType dynamicUserType = this.getUserType(frozen, cassandraOptions); final UDTValue udtValue = dynamicUserType.newValue(); idx.encodeFieldToUdt(instance, udtValue, cassandraOptions); value.encodeFieldToUdt(instance, udtValue, cassandraOptions); return udtValue; } @Override protected ImmutableUDT newInstanceFromCustomConstructor(UDTValue udtValue) { final Long idx_value = idx.decodeFromGettable(udtValue); final String value_value = value.decodeFromGettable(udtValue); return new ImmutableUDT(idx_value,value_value); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy