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>> |
suffixesByName
Holds a map of all fields annotated as suffixes keyed by the
suffix name.
|
protected Map<String,FieldInfoImpl<T>> |
suffixesByType
Holds a map of all fields annotated as suffixes keyed by the
suffix type.
|
| 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.
|
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> suffixes) |
Keyspace |
getKeyspace()
Gets the keyspace annotation for this POJO.
|
int |
getNumSuffixKeys() |
int |
getNumTables() |
T |
getObject(com.datastax.driver.core.Row row,
Map<String,Object> suffixes)
Converts the specified result row into a POJO object defined by this
class information and suffix 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() |
FieldInfo<T> |
getSuffixKey(String name) |
FieldInfo<T> |
getSuffixKeyByType(String type) |
Map<String,FieldInfoImpl<T>> |
getSuffixKeys()
Gets the field info for all suffix keys defined by this POJO.
|
Map<String,FieldInfoImpl<T>> |
getSuffixTypes()
Gets the field info for all suffix types defined by this POJO.
|
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.
|
boolean |
isColumn(String name)
Checks if the specified name is defined as a column for any tables.
|
boolean |
isSuffixKey(String name)
Checks if the specified name is defined as a suffix 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.
|
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 |
validateColumnOrSuffix(String name)
Validates if a column is defined by the POJO in any tables or if it is
defined as a suffix 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 |
validateSuffix(String suffix,
Object value)
Validates the specified suffix and its value as being a valid suffix for
the POJO.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, 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>> suffixesByName
protected final Map<String,FieldInfoImpl<T>> suffixesByType
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 getNumSuffixKeys()
getNumSuffixKeys in interface ClassInfo<T>ClassInfo.getNumSuffixKeys()public FieldInfo<T> getSuffixKey(String name)
getSuffixKey in interface ClassInfo<T>ClassInfo.getSuffixKey(java.lang.String)public FieldInfo<T> getSuffixKeyByType(String type)
getSuffixKeyByType in interface ClassInfo<T>ClassInfo.getSuffixKeyByType(java.lang.String)public boolean isSuffixKey(String name)
name - the name of the suffix keytrue if that name is defined as a suffix key;
false otherwisepublic Map<String,FieldInfoImpl<T>> getSuffixKeys()
null map of all suffix key fields keyed by
their namespublic Map<String,FieldInfoImpl<T>> getSuffixTypes()
null map of all suffix 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 validateColumnOrSuffix(String name)
name - the column name or suffix key to validateNullPointerException - if name is nullIllegalArgumentException - if the specified column or suffix 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 validateSuffix(String suffix, Object value)
suffix - the suffix to validatevalue - the value for the suffixIllegalArgumentException - if the suffix is not defined by this POJO
if the specified value is not of the right type or is
null when the field is mandatoryExcludedSuffixKeyException - if the specified suffix value is
marked as excluded the specified suffix keypublic T getObject(com.datastax.driver.core.Row row, Map<String,Object> suffixes)
row - the result row to convert into a POJOsuffixes - a map of suffix values to report back into the created
POJONullPointerException - if suffixes 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> suffixes)
getInitialObjects in interface ClassInfo<T>ClassInfo.getInitialObjects(java.util.Map)Copyright (C) 2015-2015 The Helenus Driver Project Authors.