T - the type of the class proxied by this BeanRecordProxypublic class BeanRecordProxy<T> extends Object implements Record
| Modifier and Type | Field and Description |
|---|---|
protected List<Column> |
columns |
protected T |
data |
protected EntityType |
entity |
protected Column[] |
keyColumns |
protected static org.slf4j.Logger |
log |
protected boolean[] |
modified |
| Constructor and Description |
|---|
BeanRecordProxy(BeanClass beanClass) |
BeanRecordProxy(List<Column> columns,
Column[] keyColumns,
EntityType entity) |
BeanRecordProxy(T data,
BeanClass beanClass) |
BeanRecordProxy(T data,
List<Column> columns,
Column[] keyColumns,
EntityType entity) |
| Modifier and Type | Method and Description |
|---|---|
void |
clearModified()
clears the modification status of the object and all fields.
|
Object |
get(ColumnExpr column)
returns the record value for a particular column
|
T |
getBean() |
protected Object |
getBeanProperty(Object bean,
ColumnExpr column) |
protected Object |
getBeanProperty(Object bean,
String property) |
Column |
getColumn(int index)
Overridden to change return type from ColumnExpr to Column
|
EntityType |
getEntityType()
Returns the entity this Record belongs to
|
int |
getFieldCount()
returns the number of field available
|
int |
getFieldIndex(ColumnExpr column)
returns the index of the given column expression
Indexed operations provide better performance for bulk processing
|
int |
getFieldIndex(String columnName)
returns the index of the column expression with the given name
|
Options |
getFieldOptions(Column column)
returns the Options list for the given record field.
|
Object[] |
getKey()
Returns the array of primary key columns.
|
Column[] |
getKeyColumns()
returns an array of key columns which uniquely identify the record.
|
Object |
getValue(int index)
returns the value of the field at the given index position
Indexed operations provide better performance for bulk processing compared to getValue(ColumnExpr)
|
boolean |
isFieldReadOnly(Column column)
returns true if the field is read-only.
|
boolean |
isFieldRequired(Column column)
returns true if the field is required.
|
boolean |
isFieldVisible(Column column)
returns true if the field is visible to the client.
|
boolean |
isModified()
returns true if the record has been modified.
|
boolean |
isNew()
returns true if this record is a new record.
|
boolean |
isNull(ColumnExpr column)
checks if the record contains no value (null) for the given column
|
boolean |
isNull(int index)
checks if the field at the given index position contains no value (null)
Indexed operations provide better performance for bulk processing compared to isNull(ColumnExpr)
|
boolean |
isReadOnly()
returns true if this record is readOnly.
|
boolean |
isValid()
returns true if the record is valid.
|
BeanRecordProxy<T> |
set(Column column,
Object value)
sets the value of a field.
|
void |
setBean(T data) |
int |
setBeanProperties(Object bean) |
int |
setBeanProperties(Object bean,
Collection<? extends ColumnExpr> ignoreList)
copies all field values into a static Java Bean.
|
protected void |
setBeanProperty(Object bean,
Column column,
Object value) |
int |
setRecordValues(Object bean)
sets all record values from a particular bean.
|
int |
setRecordValues(Object bean,
Collection<Column> ignoreList)
sets all record values from a particular bean.
|
void |
setValue(int i,
Object value)
sets the value of a field.
|
Object |
validateValue(Column column,
Object value)
Validates a value before it is set in the record.
|
boolean |
wasModified(Column column)
Detects whether or not a particular field has been modified.
|
protected static final org.slf4j.Logger log
protected final EntityType entity
protected final Column[] keyColumns
protected T data
protected boolean[] modified
public BeanRecordProxy(T data, List<Column> columns, Column[] keyColumns, EntityType entity)
public BeanRecordProxy(List<Column> columns, Column[] keyColumns, EntityType entity)
public BeanRecordProxy(BeanClass beanClass)
public T getBean()
public void setBean(T data)
public Column getColumn(int index)
RecordgetColumn in interface RecordgetColumn in interface RecordDataindex - field index of the column expressionpublic Column[] getKeyColumns()
RecordgetKeyColumns in interface Recordpublic Object[] getKey()
public int getFieldCount()
RecordDatagetFieldCount in interface RecordDatapublic int getFieldIndex(ColumnExpr column)
RecordDatagetFieldIndex in interface RecordDatacolumn - the column for which to return the indexpublic int getFieldIndex(String columnName)
RecordDatagetFieldIndex in interface RecordDatacolumnName - the name of the column for which to return the indexpublic Options getFieldOptions(Column column)
RecordgetFieldOptions in interface Recordcolumn - the column to check for visibilitypublic boolean isFieldVisible(Column column)
RecordisFieldVisible in interface Recordcolumn - the column to check for visibilitypublic boolean isFieldReadOnly(Column column)
RecordisFieldReadOnly in interface Recordcolumn - the requested columnpublic boolean isFieldRequired(Column column)
RecordisFieldRequired in interface Recordcolumn - the requested columnpublic boolean isModified()
RecordisModified in interface Recordpublic boolean isNew()
Recordpublic EntityType getEntityType()
RecordgetEntityType in interface Recordpublic boolean isValid()
Recordpublic boolean isReadOnly()
RecordisReadOnly in interface Recordpublic Object get(ColumnExpr column)
RecordDataget in interface RecordDatacolumn - the column for which to return the valuepublic Object getValue(int index)
RecordDatagetValue in interface RecordDataindex - the field index for which to return the valuepublic boolean isNull(ColumnExpr column)
RecordDataisNull in interface RecordDatacolumn - the columnpublic boolean isNull(int index)
RecordDataisNull in interface RecordDataindex - the field indexpublic Object validateValue(Column column, Object value)
validateValue in interface Recordcolumn - the columnvalue - the value to validatepublic BeanRecordProxy<T> set(Column column, Object value)
public final void setValue(int i,
Object value)
public boolean wasModified(Column column)
wasModified in interface Recordcolumn - the requested columnpublic void clearModified()
public int setBeanProperties(Object bean)
public int setBeanProperties(Object bean, Collection<? extends ColumnExpr> ignoreList)
RecordDataIn order to map column names to property names the property name is detected by ColumnExpr.getBeanPropertyName()
setBeanProperties in interface RecordDatabean - the Java Bean for which to set the propertiesignoreList - list of columns to skip (optional)public int setRecordValues(Object bean, Collection<Column> ignoreList)
RecordThe bean must provide corresponding getter functions for all desired column.
In order to map column names to property names the property name is detected by ColumnExpr.getBeanPropertyName()
setRecordValues in interface Recordbean - the Java Bean from which to read the value fromignoreList - list of column to ignorepublic int setRecordValues(Object bean)
RecordThe bean must provide corresponding getter functions for all desired column.
setRecordValues in interface Recordbean - the Java Bean from which to read the value fromprotected final Object getBeanProperty(Object bean, ColumnExpr column)
Copyright © 2008–2023 Apache Software Foundation. All rights reserved.