public interface MappedProperty<T>
"ttl(col1)"
.Modifier and Type | Method and Description |
---|---|
TypeCodec<T> |
getCustomCodec()
Returns the
codec to use to serialize and deserialize this property. |
String |
getMappedName()
Returns the name of the table column or UDT field that this property maps to.
|
int |
getPosition()
Returns this property's zero-based position among partition key columns or clustering columns.
|
String |
getPropertyName()
Returns this property's name.
|
TypeToken<T> |
getPropertyType()
Returns this property's type.
|
T |
getValue(Object entity)
Reads the current value of this property in the given
entity . |
boolean |
isClusteringColumn()
Returns
true if this property is a clustering column, false otherwise. |
boolean |
isComputed()
Returns
true if this property is computed, i.e. |
boolean |
isPartitionKey()
Returns
true if this property is part of the table's partition key, false
otherwise. |
void |
setValue(Object entity,
T value)
Writes the given value to this property in the given
entity . |
String getPropertyName()
null
.String getMappedName()
Note that case-sensitive identifiers should be quoted with Metadata.quote(java.lang.String)
In case of a computed
property, this method should return the CQL
expression to compute the property value, e.g. "ttl(col1)"
.
null
.TypeToken<T> getPropertyType()
null
.TypeCodec<T> getCustomCodec()
codec
to use to serialize and deserialize this property.
If this method returns null
, then a default codec for the property's type
will be used.
codec
to use to serialize and deserialize this property.boolean isPartitionKey()
true
if this property is part of the table's partition key, false
otherwise.
This method has no effect if this property is mapped to a UDT field or a CQL expression.
true
if this property is part of the table's partition key, false
otherwise.PartitionKey
boolean isClusteringColumn()
true
if this property is a clustering column, false
otherwise.
This method has no effect if this property is mapped to a UDT field or a CQL expression.
true
if this property is a clustering column, false
otherwise.ClusteringColumn
int getPosition()
For example, assuming the following primary key definition: PRIMARY KEY ((col1,
col2), col3, col4)
, col1
has position 0 (i.e. first partition key column), col2
has position 1 (i.e. second partition key column), col3
has position 0 (i.e.
first clustering key column), col4
has position 1 (i.e. second clustering key column),
This method has no effect if this property is not part of the primary key, or if it is
mapped to a UDT field or a CQL expression. Implementors are encouraged to return -1
in
these situations.
boolean isComputed()
true
if this property is computed, i.e. if it represents the result of a CQL
expression such as "ttl(col1)"
, false
otherwise.
Computed properties are not allowed with protocol v1.
Also note that computed properties are read-only.
true
if this property is computed, false
otherwise.Computed
T getValue(Object entity)
entity
.entity
- The instance to read the property from; may not be null
.IllegalArgumentException
- if the property cannot be read.void setValue(Object entity, T value)
entity
.entity
- The instance to write the property to; may not be null
.value
- The property value.IllegalArgumentException
- if the property cannot be written.Copyright © 2012–2020. All rights reserved.