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

info.archinnov.achilles.generated.meta.udt.TestUDT_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.fasterxml.jackson.databind.type.SimpleType;
import com.google.common.reflect.TypeToken;
import info.archinnov.achilles.internals.codec.FallThroughCodec;
import info.archinnov.achilles.internals.codec.JSONCodec;
import info.archinnov.achilles.internals.entities.EntityWithComplexTypes;
import info.archinnov.achilles.internals.entities.TestUDT;
import info.archinnov.achilles.internals.metamodel.AbstractProperty;
import info.archinnov.achilles.internals.metamodel.AbstractUDTClassProperty;
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.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.Integer;
import java.lang.Override;
import java.lang.String;
import java.lang.SuppressWarnings;
import java.lang.UnsupportedOperationException;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Optional;

public final class TestUDT_AchillesMeta extends AbstractUDTClassProperty {
  /**
   * Meta class for 'name' 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 TestUDT 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 name = new SimpleProperty(new FieldInfo<>((TestUDT entity$) -> entity$.getName(), (TestUDT entity$, String value$) -> entity$.setName(value$), "name", "name", ColumnType.NORMAL, new ColumnInfo(false), IndexInfo.noIndex()), DataType.text(), gettableData$ -> gettableData$.get("name", java.lang.String.class), (settableData$, value$) -> settableData$.set("name", value$, java.lang.String.class), new TypeToken(){}, new TypeToken(){}, new FallThroughCodec<>(String.class)); /** * Meta class for 'list' 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 TestUDT 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 list = new ListProperty<>(new FieldInfo<>((TestUDT entity$) -> entity$.getList(), (TestUDT entity$, List value$) -> entity$.setList(value$), "list", "list", ColumnType.NORMAL, new ColumnInfo(false), IndexInfo.noIndex()), false, false, String.class, new SimpleProperty(FieldInfo. of("list", "list", true), DataType.text(), gettable$ -> null, (udt$, value$) -> {}, new TypeToken(){}, new TypeToken(){}, new FallThroughCodec<>(String.class))); /** * Meta class for 'map' 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 TestUDT 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 map = new MapProperty(new FieldInfo<>((TestUDT entity$) -> entity$.getMap(), (TestUDT entity$, Map value$) -> entity$.setMap(value$), "map", "map", ColumnType.NORMAL, new ColumnInfo(false), IndexInfo.noIndex()), false, false, new SimpleProperty(FieldInfo. of("map", "map", true), DataType.text(), gettable$ -> null, (udt$, value$) -> {}, new TypeToken(){}, new TypeToken(){}, new JSONCodec<>(Integer.class, SimpleType.construct(Integer.class))), new SimpleProperty(FieldInfo. of("map", "map", true), DataType.text(), gettable$ -> null, (udt$, value$) -> {}, new TypeToken(){}, new TypeToken(){}, new FallThroughCodec<>(String.class))); public static final TestUDT_AchillesMeta INSTANCE = new TestUDT_AchillesMeta(); @Override protected Optional getStaticKeyspace() { return Optional.of("achilles_embedded"); } @Override protected Optional getStaticUdtName() { return Optional.of("my_type"); } @Override protected Optional getStaticNamingStrategy() { return Optional.empty(); } @Override protected String getUdtName() { return "my_type"; } @Override protected Class getUdtClass() { return TestUDT.class; } @Override protected Class getParentEntityClass() { return EntityWithComplexTypes.class; } @Override protected List> getComponentsProperty() { return Arrays.asList(name, list, map); } @Override protected List> getConstructorInjectedProperty() { return Arrays.asList(); } @Override protected UDTValue createUDTFromBean(TestUDT instance, boolean frozen, Optional cassandraOptions) { final UserType dynamicUserType = this.getUserType(frozen, cassandraOptions); final UDTValue udtValue = dynamicUserType.newValue(); name.encodeFieldToUdt(instance, udtValue, cassandraOptions); list.encodeFieldToUdt(instance, udtValue, cassandraOptions); map.encodeFieldToUdt(instance, udtValue, cassandraOptions); return udtValue; } @Override protected TestUDT newInstanceFromCustomConstructor(UDTValue udtValue) { throw new UnsupportedOperationException("Cannot instantiate entity 'info.archinnov.achilles.internals.entities.TestUDT' using custom constructor because no custom constructor (@EntityCreator) is defined"); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy