T - The type of POJO represented by this classpublic class ClassInfoImpl<T> extends Object implements ClassInfo<T>
ClassInfo class provides information about a particular
POJO class.| Modifier and Type | Class and Description |
|---|---|
class |
ClassInfoImpl.Context
The
Context class provides a specific context for the POJO
as referenced while building a statement. |
class |
ClassInfoImpl.POJOContext
The
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 Class<T> |
clazz
Holds the class for the POJO.
|
protected Constructor<T> |
constructor
Holds the default serialization constructor to use to instantiate a blank
POJO.
|
protected Class<? extends Annotation> |
entityAnnotationClass
Holds the entity annotation class used to annotated the POJO class.
|
protected Map<Field,Object> |
finalFields
Holds the map of all final fields with their default values.
|
protected Map<String,FieldInfoImpl<T>> |
keyspaceKeysByName
Holds a map of all fields annotated as keyspace keys keyed by the
keyspace key name.
|
protected Map<String,FieldInfoImpl<T>> |
keyspaceKeysByType
Holds a map of all fields annotated as keyspace keys keyed by the
keyspace key type.
|
protected StatementManagerImpl |
mgr
Holds the statement manager.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.stream.Stream<ClassInfoImpl<? extends T>> |
classInfos()
Gets all class infos (including type classes if this is a root class)
for the POJO.
|
boolean |
equals(Object obj) |
Optional<TableInfo<T>> |
getAuditTable() |
Collection<String> |
getColumns()
Retrieves all columns from the POJO no matter which table they are
defined in.
|
Object |
getDefaultValue(Field field)
Gets the default value for the specified final field.
|
Class<? extends Annotation> |
getEntityAnnotationClass()
Gets the entity annotation class used to annotated the POJO class.
|
Collection<T> |
getInitialObjects(Map<String,String> keyspaceKeys) |
Keyspace |
getKeyspace()
Gets the keyspace annotation for this POJO.
|
FieldInfo<T> |
getKeyspaceKey(String name) |
FieldInfo<T> |
getKeyspaceKeyByType(String type) |
Map<String,FieldInfoImpl<T>> |
getKeyspaceKeys()
Gets the field info for all keyspace keys defined by this POJO.
|
Map<String,FieldInfoImpl<T>> |
getKeyspaceKeyTypes()
Gets the field info for all keyspace key types defined by this POJO.
|
int |
getNumKeyspaceKeys() |
int |
getNumTables() |
T |
getObject(com.datastax.driver.core.Row row,
Map<String,Object> keyspaceKeys)
Converts the specified result row into a POJO object defined by this
class information and keyspace key map.
|
T |
getObject(com.datastax.driver.core.UDTValue uval)
Converts the specified UDT value into a POJO object defined by this
class information.
|
Class<T> |
getObjectClass()
Gets the class of POJO represented by this class info object.
|
Optional<TableInfo<T>> |
getPrimaryTable() |
TableInfo<T> |
getTable(String name) |
TableInfoImpl<T> |
getTableImpl(String name)
Gets the table info corresponding to the given table name.
|
Collection<TableInfo<T>> |
getTables() |
protected Collection<TableInfoImpl<T>> |
getTablesImpl()
Gets the tables info defined by the POJO.
|
int |
hashCode() |
boolean |
isColumn(String name)
Checks if the specified name is defined as a column for any tables.
|
boolean |
isKeyspaceKey(String name)
Checks if the specified name is defined as a keyspace key.
|
Iterator<TableInfo<T>> |
iterator() |
ClassInfoImpl.Context |
newContext()
Creates a new context for this class info.
|
ClassInfoImpl.POJOContext |
newContext(T object)
Creates a new context for this class info with the given POJO object.
|
java.util.stream.Stream<Class<? extends T>> |
objectClasses()
Gets all classes (including type classes if this is a root class) for
the POJO represented by this class info object.
|
boolean |
supportsTablesAndIndexes() |
java.util.stream.Stream<TableInfo<T>> |
tables() |
protected java.util.stream.Stream<TableInfoImpl<T>> |
tablesImpl()
Gets the tables info defined by the POJO.
|
String |
toString() |
java.util.stream.Stream<UDTClassInfoImpl<?>> |
udts()
Gets all user-defined types the pojo class represented by this class is
dependent on.
|
void |
validateColumn(Object name)
Validates if a column is defined by the POJO in any tables.
|
void |
validateColumnAndValue(String name,
Object value)
Validates if a column is defined by the POJO and its potential value in
any table.
|
void |
validateColumnOrKeyspaceKey(String name)
Validates if a column is defined by the POJO in any tables or if it is
defined as a keyspace key.
|
void |
validateColumns(Iterable<Object> names)
Validates if specified columns are defined by the POJO in any tables.
|
void |
validateColumns(String... names)
Validates if specified columns are defined by the POJO in any table.
|
void |
validateKeyspaceKey(String name,
Object value)
Validates the specified keyspace key and its value as being a valid keyspace
key for the POJO.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitforEach, spliteratorprotected final Class<? extends Annotation> entityAnnotationClass
protected final Constructor<T> constructor
protected final Map<Field,Object> finalFields
protected final Map<String,FieldInfoImpl<T>> keyspaceKeysByName
protected final Map<String,FieldInfoImpl<T>> keyspaceKeysByType
protected final StatementManagerImpl mgr
protected java.util.stream.Stream<TableInfoImpl<T>> tablesImpl()
protected Collection<TableInfoImpl<T>> getTablesImpl()
public Class<? extends Annotation> getEntityAnnotationClass()
public Class<T> getObjectClass()
getObjectClass in interface ClassInfo<T>null type of POJO represented by this class
infopublic boolean supportsTablesAndIndexes()
supportsTablesAndIndexes in interface ClassInfo<T>ClassInfo.supportsTablesAndIndexes()public java.util.stream.Stream<Class<? extends T>> objectClasses()
public java.util.stream.Stream<ClassInfoImpl<? extends T>> classInfos()
public java.util.stream.Stream<UDTClassInfoImpl<?>> udts()
public Object getDefaultValue(Field field)
field - the non-null final field for which to gets its
default valueIllegalArgumentException - if the field is not a defined final field
for the associated class or one of its super class up to and
excluding the first one that is not annotated with the entity
annotationpublic Keyspace getKeyspace()
getKeyspace in interface ClassInfo<T>null keyspace annotation for this POJOpublic int getNumKeyspaceKeys()
getNumKeyspaceKeys in interface ClassInfo<T>ClassInfo.getNumKeyspaceKeys()public FieldInfo<T> getKeyspaceKey(String name)
getKeyspaceKey in interface ClassInfo<T>ClassInfo.getKeyspaceKey(java.lang.String)public FieldInfo<T> getKeyspaceKeyByType(String type)
getKeyspaceKeyByType in interface ClassInfo<T>ClassInfo.getKeyspaceKeyByType(java.lang.String)public boolean isKeyspaceKey(String name)
name - the name of the keyspace keytrue if that name is defined as a keyspace key;
false otherwisepublic Map<String,FieldInfoImpl<T>> getKeyspaceKeys()
null map of all keyspace key fields keyed by
their namespublic Map<String,FieldInfoImpl<T>> getKeyspaceKeyTypes()
null map of all keyspace key type fields keyed by
their typespublic TableInfoImpl<T> getTableImpl(String name)
name - the name of the table to getNullPointerException - if name is nullIllegalArgumentException - if the specified table is not defined by
the POJOpublic TableInfo<T> getTable(String name)
getTable in interface ClassInfo<T>ClassInfo.getTable(java.lang.String)public Optional<TableInfo<T>> getPrimaryTable()
getPrimaryTable in interface ClassInfo<T>ClassInfo.getPrimaryTable()public Optional<TableInfo<T>> getAuditTable()
getAuditTable in interface ClassInfo<T>ClassInfo.getAuditTable()public int getNumTables()
getNumTables in interface ClassInfo<T>ClassInfo.getNumTables()public Collection<TableInfo<T>> getTables()
getTables in interface ClassInfo<T>ClassInfo.getTables()public java.util.stream.Stream<TableInfo<T>> tables()
tables in interface ClassInfo<T>ClassInfo.tables()public Collection<String> getColumns()
null set of all columns for the POJOpublic ClassInfoImpl.Context newContext()
null newly created context for this class infopublic ClassInfoImpl.POJOContext newContext(T object)
object - the POJO objectnull newly created context for this class infoNullPointerException - if object is nullIllegalArgumentException - if object is not of the
appropriate classpublic boolean isColumn(String name)
name - the name of the columntrue if that name is defined as a column for any tables;
false otherwisepublic void validateColumn(Object name)
name - the column name to validateNullPointerException - if name is nullIllegalArgumentException - if any of the specified columns are not defined
by the POJOpublic void validateColumnOrKeyspaceKey(String name)
name - the column name or keyspace key to validateNullPointerException - if name is nullIllegalArgumentException - if the specified column or keyspace key is
not defined by the POJOpublic void validateColumns(Iterable<Object> names)
names - the names of the column to validateNullPointerException - if any of the column names are nullIllegalArgumentException - if any of the column names are not
defined by the POJOpublic void validateColumns(String... names)
names - the names of the column to validateNullPointerException - if any of the column names are nullIllegalArgumentException - if any of the column names are not
defined by the POJOpublic void validateColumnAndValue(String name, Object value)
name - the column name to validatevalue - the value to validate for the columnNullPointerException - if name is nullIllegalArgumentException - if the specified column is not defined
by the POJO or if the specified value is not of the
right type or is null when the column is mandatorypublic void validateKeyspaceKey(String name, Object value)
name - the keyspace key to validatevalue - the value for the keyspace keyIllegalArgumentException - if the keyspace key is not defined by this POJO
if the specified value is not of the right type or is
null when the field is mandatoryExcludedKeyspaceKeyException - if the specified keyspace key value is
marked as excluded the specified keyspace keypublic T getObject(com.datastax.driver.core.Row row, Map<String,Object> keyspaceKeys)
row - the result row to convert into a POJOkeyspaceKeys - a map of keyspace key values to report back into the created
POJONullPointerException - if keyspaceKeys is nullObjectConversionException - if unable to convert to a POJOpublic T getObject(com.datastax.driver.core.UDTValue uval)
uval - the UDT value to convert into a POJOObjectConversionException - if unable to convert to a POJOpublic Collection<T> getInitialObjects(Map<String,String> keyspaceKeys)
getInitialObjects in interface ClassInfo<T>ClassInfo.getInitialObjects(java.util.Map)public int hashCode()
hashCode in class ObjectObject.hashCode()public boolean equals(Object obj)
equals in class ObjectObject.equals(java.lang.Object)public String toString()
toString in class ObjectObject.toString()Copyright (C) 2015-2017 The Helenus Driver Project Authors.