public class RowDefinitionClassWrapper extends Object
To wrap a target object instance, use the
instanceWrapperFor(nz.co.gregs.dbvolution.query.RowDefinition)
method.
Note: instances of this class are expensive to create, and are intended to be cached and kept long-term. Instances can be safely shared between DBDatabase instances for different database types.
Instances of this class are thread-safe.
Support DBvolution at Patreon
| Constructor and Description |
|---|
RowDefinitionClassWrapper(Class<? extends RowDefinition> clazz)
Fully constructs a wrapper for the given class, including performing all
validations that can be performed up front.
|
| Modifier and Type | Method and Description |
|---|---|
Class<? extends RowDefinition> |
adapteeClass()
Gets the underlying wrapped class.
|
boolean |
equals(Object obj)
Two
RowDefinitionClassWrappers are equal if they wrap the same
classes. |
List<PropertyWrapperDefinition> |
getAutoFillingPropertyDefinitions()
Gets all properties NOT annotated with
DBColumn. |
List<PropertyWrapperDefinition> |
getColumnPropertyDefinitions()
Gets all properties annotated with
DBColumn. |
List<PropertyWrapperDefinition> |
getForeignKeyPropertyDefinitions()
Gets all foreign key properties.
|
List<PropertyWrapperDefinition> |
getPrimaryKeyPropertyDefinitions()
Gets all primary key properties.
|
PropertyWrapperDefinition |
getPropertyDefinitionByColumn(DBDatabase database,
String columnName)
Gets the property associated with the given column.
|
PropertyWrapperDefinition |
getPropertyDefinitionByName(String propertyName)
Gets the property by its java property name.
|
int |
hashCode()
Calculates the hash-code based on the hash-code of the wrapped class.
|
RowDefinitionInstanceWrapper |
instanceWrapperFor(RowDefinition target)
Gets an object wrapper instance for the given target object
|
boolean |
isTable()
Indicates whether this class maps to a database table.
|
String |
javaName()
Gets the simple name of the class being wrapped by this adaptor.
|
PropertyWrapperDefinition[] |
primaryKeyDefinitions()
Gets the property that is the primary key, if one is marked.
|
String |
qualifiedJavaName()
Gets the fully qualified name of the class being wrapped by this adaptor.
|
String |
selectQuery()
Support DBvolution at Patreon |
String |
tableName()
Gets the indicated table name.
|
String |
toString()
Gets a string representation suitable for debugging.
|
public RowDefinitionClassWrapper(Class<? extends RowDefinition> clazz)
clazz - the DBRow class to wrappublic RowDefinitionInstanceWrapper instanceWrapperFor(RowDefinition target)
target - the DBRow instance
Support DBvolution at Patreon
public String toString()
Support DBvolution at Patreon
public boolean equals(Object obj)
RowDefinitionClassWrappers are equal if they wrap the same
classes.public int hashCode()
Support DBvolution at Patreon
public Class<? extends RowDefinition> adapteeClass()
Support DBvolution at Patreon
public String javaName()
Use tableName() for the name of the table mapped to this class.
Equivalent to this.adaptee().getSimpleName();
Support DBvolution at Patreon
public String qualifiedJavaName()
Use tableName() for the name of the table mapped to this class.
Support DBvolution at Patreon
public boolean isTable()
Support DBvolution at Patreon
public String tableName()
DBTableName annotation is present but doesn't provide an explicit
table name.
If the DBTableName annotation is missing, this method returns
null.
Use TableHandler.getDBTableNameAnnotation() for low level access.
Support DBvolution at Patreon
public String selectQuery()
Support DBvolution at Patreon
public PropertyWrapperDefinition[] primaryKeyDefinitions()
Support DBvolution at Patreon
public PropertyWrapperDefinition getPropertyDefinitionByColumn(DBDatabase database, String columnName)
Only provides access to properties annotated with DBColumn.
Assumes validation is applied elsewhere to prohibit duplication of column names.
database - active databasecolumnName - columnName columnName
Support DBvolution at Patreon
AssertionError - if called when in identityOnly mode.public PropertyWrapperDefinition getPropertyDefinitionByName(String propertyName)
Only provides access to properties annotated with DBColumn.
It's legal for a field and bean-property to have the same name, and to both be annotated, but for different columns. This method doesn't handle that well and returns only the first one it sees.
propertyName - propertyName
Support DBvolution at Patreon
AssertionError - if called when in identityOnly mode.public List<PropertyWrapperDefinition> getColumnPropertyDefinitions()
DBColumn.
Support DBvolution at Patreon
public List<PropertyWrapperDefinition> getAutoFillingPropertyDefinitions()
DBColumn.
Support DBvolution at Patreon
public List<PropertyWrapperDefinition> getForeignKeyPropertyDefinitions()
Support DBvolution at Patreon
public List<PropertyWrapperDefinition> getPrimaryKeyPropertyDefinitions()
Support DBvolution at Patreon
Copyright © 2018. All Rights Reserved.