R
- row classpublic class RowTranslator<R> extends ColumnsTranslator<R>
ColumnTranslator
objects
are created for each column based upon annotations on row class.
If no Column
annotation exists for a field, then column name is same as field
name and StandardColumnTranslator
is used.
If any of the following are true, then field is assumed to be cascaded:
TypeTranslator
Constructor and Description |
---|
RowTranslator(Table<R> table,
Row rowAnnotation)
Constructs for a table.
|
Modifier and Type | Method and Description |
---|---|
java.util.List<java.lang.reflect.Field> |
getCascadeFieldList()
Gets list of fields that are to be cascaded.
|
protected java.lang.reflect.Field |
getDeclaredField(java.lang.Class<?> clazz,
java.lang.String fieldName)
Recurisvely searches for declared field in superclass(es) of clazz and then clazz parameter.
|
java.lang.reflect.Field |
getDeclaredField(java.lang.String fieldName)
Gets a declared field of
ColumnsTranslator.getRowClass() . |
java.lang.reflect.Field[] |
getDeclaredFields()
Gets all of the declared fields for
ColumnsTranslator.getRowClass() . |
protected void |
getDeclaredFields(java.lang.Class<?> clazz,
java.util.List<java.lang.reflect.Field[]> classHierarchyFields)
Recurisvely searches for declared fields in super class(es) of clazz and then clazz parameter.
|
ColumnTranslator<R> |
getIdentityColumnTranslator()
Column translator used to set the value of a row column that is the identity column
for row.
|
PrimaryKeyWhereTranslator<R> |
getPrimaryKeyWhereTranslator()
Gets primary key translator for use in where clause.
|
java.lang.String |
getUnusedColumnInsertNamesSql()
Gets names of unused columns for insert statement.
|
java.lang.String |
getUnusedColumnInsertValuesSql()
Gets values for unused columns for insert statement.
|
java.lang.String |
getUnusedColumnUpdateSql()
Gets column=value for all unused columns for update statement.
|
protected void |
initColumnTranslators()
|
protected void |
initUnusedColumnSql(java.lang.Class<R> rowClass)
Process
UnusedColumns annotations. |
boolean |
isInheritedFields()
Reports if super class fields are used.
|
boolean |
isZeroRowCountPostExecute()
Reports when to invoke
ModifyOperation post execute methods. |
void |
setInheritedFields(boolean inheritedFields)
Sets if super class fields are used.
|
void |
setZeroRowCountPostExecute(boolean zeroRowCountPostExecute)
Sets when to invoke
ModifyOperation post execute methods. |
addColumnTranslator, createColumnParameterPhrase, createColumnPhrase, createParameterPhrase, getColumnTranslator, getColumnTranslatorList, getRowClass, initColumnTranslatorList, isIncluded, isIncludeIdentityColumns, isIncludeReadOnlyColumns, read, setIncludeIdentityColumns, setIncludeReadOnlyColumns, write
public RowTranslator(Table<R> table, Row rowAnnotation) throws TranslatorException
table
- table associated with this row translatorrowAnnotation
- row annotation on table or row classTranslatorException
- if errorpublic ColumnTranslator<R> getIdentityColumnTranslator()
Column.identity()
.Column.identity()
public boolean isInheritedFields()
ColumnsTranslator.getRowClass()
Row.inhertedFields()
public void setInheritedFields(boolean inheritedFields)
inheritedFields
- true if fields used include super class fields; false to use only fields in ColumnsTranslator.getRowClass()
Row.inhertedFields()
public boolean isZeroRowCountPostExecute()
ModifyOperation
post execute methods.Row.zeroRowCountPostExecute()
public void setZeroRowCountPostExecute(boolean zeroRowCountPostExecute)
ModifyOperation
post execute methods.zeroRowCountPostExecute
- true to invoke post execute methods unconditionally;
false to invoke post execute methods only when database has been modified by
insert, update, or deleteRow.zeroRowCountPostExecute()
public java.lang.reflect.Field[] getDeclaredFields()
ColumnsTranslator.getRowClass()
. Also gets declared fields for
subclass(es) if isInheritedFields()
is true. Subclass fields appear in array prior
to superclass fields.protected void getDeclaredFields(java.lang.Class<?> clazz, java.util.List<java.lang.reflect.Field[]> classHierarchyFields)
clazz
- get fields from this class and superclass(es)classHierarchyFields
- each class fields are added to this listpublic java.lang.reflect.Field getDeclaredField(java.lang.String fieldName)
ColumnsTranslator.getRowClass()
. Searches for declared fields in
subclass(es) of ColumnsTranslator.getRowClass()
if isInheritedFields()
is true. Subclasses
are searched prior to to superclasses.fieldName
- get field for this nameprotected java.lang.reflect.Field getDeclaredField(java.lang.Class<?> clazz, java.lang.String fieldName)
clazz
- get fields from this class and superclass(es)fieldName
- get field for this nameprotected void initColumnTranslators() throws TranslatorException
Transient
and Cascade
annotations.
Versions prior to 1.9.2 did not allow type translators to be replaced. Starting with
version 1.9.2 and 2.3.2, this method will replace existing type translator with new
one ImplicitType.translator()
is different from existing.
TranslatorException
- if errorjava.lang.IllegalAccessException
java.lang.InstantiationException
public java.util.List<java.lang.reflect.Field> getCascadeFieldList()
TypeTranslator
protected void initUnusedColumnSql(java.lang.Class<R> rowClass) throws TranslatorException
UnusedColumns
annotations.rowClass
- TranslatorException
public PrimaryKeyWhereTranslator<R> getPrimaryKeyWhereTranslator()
public java.lang.String getUnusedColumnInsertNamesSql()
public java.lang.String getUnusedColumnInsertValuesSql()
public java.lang.String getUnusedColumnUpdateSql()