public class ClassInfoImpl.POJOContext extends ClassInfoImpl.Context
POJOContext class provides a specific context for the POJO
as referenced while building an insert or update statement.| Modifier and Type | Field and Description |
|---|---|
protected T |
object
Holds the POJO object
|
keyspaceKeys| Constructor and Description |
|---|
POJOContext(T object)
Instantiates a new
POJOContext object. |
| Modifier and Type | Method and Description |
|---|---|
void |
addKeyspaceKey(String name)
Adds a keyspace key to the context for use in keyspace name creation by
retrieving its value from the associated POJO.
|
Pair<Object,CQLDataType> |
getColumnNonEncodedValue(String tname,
CharSequence name)
Retrieves the specified column non-encoded value from the POJO and the
specified table.
|
Pair<Object,CQLDataType> |
getColumnValue(String tname,
CharSequence name)
Retrieves the specified column value from the POJO and the specified
table.
|
Map<String,Pair<Object,CQLDataType>> |
getColumnValues(String tname)
Retrieves all columns and their values from the POJO and the specified
table.
|
Map<String,Pair<Object,CQLDataType>> |
getColumnValues(String tname,
CharSequence... names)
Retrieves the specified columns and their values from the POJO and the
specified table.
|
Map<String,Pair<Object,CQLDataType>> |
getColumnValues(String tname,
Iterable<CharSequence> names)
Retrieves the specified columns and their values from the POJO and the
specified table.
|
Map<String,Pair<Object,CQLDataType>> |
getKeyspaceAndPartitionKeyColumnValues(String tname)
Retrieves all keyspace and partition key columns and their values from the
POJO and the specified table.
|
Map<String,Pair<Object,CQLDataType>> |
getKeyspaceAndPrimaryKeyColumnValues(String tname)
Retrieves all keyspace and primary key columns and their values from the
POJO and the specified table.
|
Map<String,Pair<Object,CQLDataType>> |
getKeyspaceKeyValues()
Retrieves all keyspace keys and their values from the POJO.
|
Map<String,Pair<Object,CQLDataType>> |
getMandatoryAndPrimaryKeyColumnValues(String tname)
Retrieves all mandatory and primary key columns and their values from
the POJO and the specified table.
|
Map<String,Pair<Object,CQLDataType>> |
getNonPrimaryKeyColumnNonEncodedValues(String tname)
Retrieves all non primary key columns and their non-encoded values from
the POJO from the specified table.
|
T |
getObject()
Gets the POJO object associated with this context.
|
Map<String,Pair<Object,CQLDataType>> |
getPartitionKeyColumnValues(String tname)
Retrieves all partition key columns and their values from the POJO and the
specified table.
|
Map<String,Pair<Object,CQLDataType>> |
getPrimaryKeyColumnValues(String tname)
Retrieves all primary key columns and their values from the POJO and the
specified table.
|
Map<String,Pair<Object,CQLDataType>> |
getPrimaryKeyColumnValues(String tname,
Map<String,Object> pkeys_override)
Retrieves all primary key columns and their values from the POJO and the
specified table while giving priority to values provided by the specified
override map.
|
protected void |
populateKeyspaceKeys(Map<String,FieldInfoImpl<T>> fields)
Populates the keyspace keys defined in the given map from the POJO.
|
addKeyspaceKey, getClassInfo, getInitialObjects, getKeyspace, getObject, getObject, getObjectClassprotected final T object
public POJOContext(T object)
POJOContext object.object - the POJO objectNullPointerException - if object is nullIllegalArgumentException - if object is not of the
appropriate classprotected void populateKeyspaceKeys(Map<String,FieldInfoImpl<T>> fields)
fields - the map of keyspace key fields from the POJO where to extract
the keyspace key valuespublic T getObject()
public Map<String,Pair<Object,CQLDataType>> getColumnValues(String tname)
tname - the name of the table from which to retrieve columnsnull map of all column/value pairs for the POJOIllegalArgumentException - if a mandatory column is missing from the POJOColumnPersistenceException - if unable to persist a column's valuepublic Map<String,Pair<Object,CQLDataType>> getPartitionKeyColumnValues(String tname)
tname - the name of the table from which to retrieve columnsnull map of all partition key column/value pairs
for the POJOIllegalArgumentException - if a column is missing from the POJOColumnPersistenceException - if unable to persist a column's valuepublic Map<String,Pair<Object,CQLDataType>> getKeyspaceAndPartitionKeyColumnValues(String tname)
tname - the name of the table from which to retrieve columnsnull map of all keyspace key and partition key
column/value pairs for the POJOIllegalArgumentException - if a column or a keyspace key is missing from
the POJOColumnPersistenceException - if unable to persist a column's valuepublic Map<String,Pair<Object,CQLDataType>> getPrimaryKeyColumnValues(String tname)
tname - the name of the table from which to retrieve columnsnull map of all primary key column/value pairs
for the POJOIllegalArgumentException - if a column is missing from the POJOColumnPersistenceException - if unable to persist a column's valuepublic Map<String,Pair<Object,CQLDataType>> getPrimaryKeyColumnValues(String tname, Map<String,Object> pkeys_override)
tname - the name of the table from which to retrieve columnspkeys_override - a non-null map of primary key values
to use instead of those provided by the objectnull map of all primary key column/value pairs
for the POJOIllegalArgumentException - if a column is missing from the POJOColumnPersistenceException - if unable to persist a column's valuepublic Map<String,Pair<Object,CQLDataType>> getKeyspaceKeyValues()
null map of all keyspace key name/value pairs
for the POJOIllegalArgumentException - if a keyspace key is missing from the POJOColumnPersistenceException - if unable to persist a keyspace key's valuepublic Map<String,Pair<Object,CQLDataType>> getKeyspaceAndPrimaryKeyColumnValues(String tname)
tname - the name of the table from which to retrieve columnsnull map of all keyspace key and primary key
column/value pairs for the POJOIllegalArgumentException - if a column or a keyspace key is missing from
the POJOColumnPersistenceException - if unable to persist a column's valuepublic Map<String,Pair<Object,CQLDataType>> getMandatoryAndPrimaryKeyColumnValues(String tname)
tname - the name of the table from which to retrieve columnsnull map of all mandatory and primary key
column/value pairs for the POJOIllegalArgumentException - if a column is missing from the POJOColumnPersistenceException - if unable to persist a column's valuepublic Map<String,Pair<Object,CQLDataType>> getNonPrimaryKeyColumnNonEncodedValues(String tname)
Note: The returned values should not be encoded.
tname - the name of the table from which to retrieve columnsnull map of all non primary key column/value
(non-encoded) pairs for the POJOIllegalArgumentException - if a mandatory column is missing from
the POJOpublic Pair<Object,CQLDataType> getColumnNonEncodedValue(String tname, CharSequence name)
tname - the name of the table from which to retrieve the columnname - the name of the column to retrieveIllegalArgumentException - if the column name is not defined by the
POJO or is mandatory and missing from the POJOColumnPersistenceException - if unable to persist a column's valuepublic Pair<Object,CQLDataType> getColumnValue(String tname, CharSequence name)
tname - the name of the table from which to retrieve the columnname - the name of the column to retrieveIllegalArgumentException - if the column name is not defined by the
POJO or is mandatory and missing from the POJOColumnPersistenceException - if unable to persist a column's valuepublic Map<String,Pair<Object,CQLDataType>> getColumnValues(String tname, Iterable<CharSequence> names)
tname - the name of the table from which to retrieve the columnnames - the names of the columns to retrievenull map of all requested column/value pairs
for the POJOIllegalArgumentException - if any of the column names are not defined
by the POJO or is mandatory and missing from the POJOColumnPersistenceException - if unable to persist a column's valuepublic Map<String,Pair<Object,CQLDataType>> getColumnValues(String tname, CharSequence... names)
tname - the name of the table from which to retrieve the columnnames - the names of the columns to retrievenull map of all requested column/value pairs
for the POJOIllegalArgumentException - if any of the column names are not defined
by the POJO or is mandatory and missing from the POJOColumnPersistenceException - if unable to persist a column's valuepublic void addKeyspaceKey(String name)
name - the keyspace nameNullPointerException - if name is nullIllegalArgumentException - if the POJO doesn't require the specified
keyspace key or if the value doesn't match the POJO's definition for the
specified keyspace keyExcludedKeyspaceKeyException - if the specified keyspace key value is
marked as excluded the specified keyspace keyCopyright (C) 2015-2015 The Helenus Driver Project Authors.