T - The type of POJO represented by this fieldpublic class FieldInfoImpl<T> extends Object implements FieldInfo<T>
FieldInfo class caches all the field information needed by
the class ClassInfo.
Note: A fake TableInfoImpl class with no table annotations
might be passed in for user-defined type entities. By design, this class
will not allow any type of keys but only columns.
| Modifier and Type | Field and Description |
|---|---|
protected DataTypeImpl.Definition |
definition
Holds the data type definition for this field (if it is a column).
|
TableInfoImpl<T> |
tinfo
Holds the table information for this field.
|
| Modifier and Type | Method and Description |
|---|---|
void |
decodeAndSetValue(T object,
com.datastax.driver.core.Row row)
Decodes and sets the field's value in the specified POJO based on the given
row.
|
void |
decodeAndSetValue(T object,
com.datastax.driver.core.UDTValue uval)
Decodes and sets the field's value in the specified POJO based on the given
UDT value.
|
Object |
decodeValue(com.datastax.driver.core.Row row)
Decodes the field's value based on the given row.
|
Object |
decodeValue(com.datastax.driver.core.UDTValue uval)
Decodes the field's value based on the given UDT value.
|
<A extends Annotation> |
getAnnotation(Class<A> annotationClass) |
ClassInfo<T> |
getClassInfo() |
ClusteringKey |
getClusteringKey() |
com.datastax.driver.core.TypeCodec<?> |
getCodec()
Gets a codec for this field.
|
String |
getColumnName() |
DataTypeImpl.Definition |
getDataType()
Gets the column data type for this field.
|
Class<?> |
getDeclaringClass() |
Object |
getFinalValue()
Gets the final value for the field if it is defined as final.
|
Index |
getIndex() |
KeyspaceKey |
getKeyspaceKey() |
String |
getKeyspaceKeyName() |
String |
getName() |
Class<T> |
getObjectClass() |
PartitionKey |
getPartitionKey() |
TableInfo<T> |
getTableInfo() |
Class<?> |
getType() |
TypeKey |
getTypeKey() |
Object |
getValue(Class<?> clazz,
T object)
Retrieves the field's encoded value from the specified POJO.
|
Object |
getValue(T object)
Retrieves the field's encoded value from the specified POJO.
|
boolean |
isCaseInsensitiveKey() |
boolean |
isClusteringKey() |
boolean |
isColumn() |
boolean |
isCounter() |
boolean |
isFinal() |
boolean |
isIndex() |
boolean |
isKeyspaceKey() |
boolean |
isLast() |
boolean |
isMandatory() |
boolean |
isMultiKey() |
boolean |
isOptional()
Checks if the field is defined as optional.
|
boolean |
isPartitionKey() |
boolean |
isStatic() |
boolean |
isTypeKey() |
void |
setValue(T object,
Object value)
Sets the field's value in the specified POJO with the given value.
|
String |
toString() |
java.util.stream.Stream<UDTClassInfoImpl<?>> |
udts()
Gets all user-defined types this field is dependent on.
|
void |
validateCollectionValue(Object value)
Validate the provided element value for this collection field.
|
void |
validateListValue(Object value)
Validate the provided value for this list field.
|
void |
validateMapKey(Object key)
Validate the provided mapping key for this map field.
|
void |
validateMapKeyValue(Object key,
Object value)
Validate the provided mapping key/value for this map field.
|
void |
validateSetValue(Object value)
Validate the provided value for this set field.
|
void |
validateValue(Object value)
Validate the provided value for this field.
|
public final TableInfoImpl<T> tinfo
null if
the field is only used as a keyspace key.protected final DataTypeImpl.Definition definition
public Class<T> getObjectClass()
getObjectClass in interface FieldInfo<T>FieldInfo.getObjectClass()public Class<?> getDeclaringClass()
getDeclaringClass in interface FieldInfo<T>FieldInfo.getDeclaringClass()public ClassInfo<T> getClassInfo()
getClassInfo in interface FieldInfo<T>FieldInfo.getClassInfo()public TableInfo<T> getTableInfo()
getTableInfo in interface FieldInfo<T>FieldInfo.getTableInfo()public String getName()
getName in interface FieldInfo<T>FieldInfo.getName()public Class<?> getType()
getType in interface FieldInfo<T>FieldInfo.getType()public boolean isColumn()
isColumn in interface FieldInfo<T>FieldInfo.isColumn()public boolean isStatic()
isStatic in interface FieldInfo<T>FieldInfo.isStatic()public String getColumnName()
getColumnName in interface FieldInfo<T>FieldInfo.getColumnName()public String getKeyspaceKeyName()
getKeyspaceKeyName in interface FieldInfo<T>FieldInfo.getKeyspaceKeyName()public DataTypeImpl.Definition getDataType()
null otherwisepublic boolean isKeyspaceKey()
isKeyspaceKey in interface FieldInfo<T>FieldInfo.isKeyspaceKey()public KeyspaceKey getKeyspaceKey()
getKeyspaceKey in interface FieldInfo<T>FieldInfo.getKeyspaceKey()public boolean isMandatory()
isMandatory in interface FieldInfo<T>FieldInfo.isMandatory()public boolean isOptional()
true if the field is defined as optional; false
otherwisepublic boolean isIndex()
isIndex in interface FieldInfo<T>FieldInfo.isIndex()public Index getIndex()
getIndex in interface FieldInfo<T>FieldInfo.getIndex()public boolean isCounter()
isCounter in interface FieldInfo<T>FieldInfo.isCounter()public boolean isLast()
isLast in interface FieldInfo<T>FieldInfo.isLast()public boolean isPartitionKey()
isPartitionKey in interface FieldInfo<T>FieldInfo.isPartitionKey()public PartitionKey getPartitionKey()
getPartitionKey in interface FieldInfo<T>FieldInfo.getPartitionKey()public boolean isClusteringKey()
isClusteringKey in interface FieldInfo<T>FieldInfo.isClusteringKey()public ClusteringKey getClusteringKey()
getClusteringKey in interface FieldInfo<T>FieldInfo.getClusteringKey()public boolean isCaseInsensitiveKey()
isCaseInsensitiveKey in interface FieldInfo<T>FieldInfo.isCaseInsensitiveKey()public boolean isTypeKey()
isTypeKey in interface FieldInfo<T>FieldInfo.isTypeKey()public TypeKey getTypeKey()
getTypeKey in interface FieldInfo<T>FieldInfo.getClusteringKey()public boolean isMultiKey()
isMultiKey in interface FieldInfo<T>FieldInfo.isMultiKey()public <A extends Annotation> A getAnnotation(Class<A> annotationClass)
getAnnotation in interface FieldInfo<T>FieldInfo.getAnnotation(java.lang.Class)public void validateValue(Object value)
value - the value to be validatedIllegalArgumentException - if the specified value is not of the
right type or is null when the field is mandatoryExcludedKeyspaceKeyException - if this field is a keyspace key and the
specified value is marked as excludedpublic com.datastax.driver.core.TypeCodec<?> getCodec()
public void validateCollectionValue(Object value)
value - the element value to be validatedIllegalArgumentException - if the specified value is not of the
right type or is null when the column is mandatorypublic void validateListValue(Object value)
value - the element value to be validatedIllegalArgumentException - if the specified value is not of the
right element type or the value is null when the
column is mandatorypublic void validateSetValue(Object value)
value - the element value to be validatedIllegalArgumentException - if the specified value is not of the
right element type or the value is null when the
column is mandatorypublic void validateMapKeyValue(Object key, Object value)
key - the mapping key to be validatedvalue - the mapping value to be validatedIllegalArgumentException - if the specified key/value are not
of the right mapping types or the value is null
when the column is mandatorypublic void validateMapKey(Object key)
key - the mapping key to be validatedIllegalArgumentException - if the specified key is not
of the right mapping typespublic boolean isFinal()
isFinal in interface FieldInfo<T>FieldInfo.isFinal()public Object getFinalValue()
null
otherwisepublic Object getValue(T object)
object - the POJO from which to retrieve the field's valueNullPointerException - if object is nullpublic Object getValue(Class<?> clazz, T object)
clazz - the class for the expected valueobject - the POJO from which to retrieve the field's valueNullPointerException - if object is nullClassCastException - if the field value from the given object
cannot be type casted to the specified classpublic void setValue(T object, Object value)
object - the POJO in which to set the field's valuevalue - the value to set the field withNullPointerException - if object is null
or if the column is a primary key or mandatory and
value is nullpublic Object decodeValue(com.datastax.driver.core.Row row)
row - the row where the column encoded value is definedNullPointerException - if row is nullObjectConversionException - if unable to decode the column or if the
column is not defined in the given rowpublic void decodeAndSetValue(T object, com.datastax.driver.core.Row row)
object - the POJO in which to set the field's decoded valuerow - the row where the column encoded value is definedNullPointerException - if object or row is
nullObjectConversionException - if unable to decode the column and store
the corresponding value into the POJO object or if the column is
a primary key, type key, or mandatory and not defined in the given
rowpublic Object decodeValue(com.datastax.driver.core.UDTValue uval)
uval - the UDT value where the column encoded value is definedNullPointerException - if uval is nullObjectConversionException - if unable to decode the column or if the
column is not defined in the given UDT valuepublic void decodeAndSetValue(T object, com.datastax.driver.core.UDTValue uval)
object - the POJO in which to set the field's decoded valueuval - the UDT value where the column encoded value is definedNullPointerException - if object or uval is
nullObjectConversionException - if unable to decode the column and store
the corresponding value into the POJO object or if the column is
mandatory and not defined in the given UDT valuepublic java.util.stream.Stream<UDTClassInfoImpl<?>> udts()
public String toString()
toString in class ObjectObject.toString()Copyright (C) 2015-2017 The Helenus Driver Project Authors.