|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.empire.data.bean.BeanRecordProxy<T>
T
- the type of the class proxied by this BeanRecordProxy
public class BeanRecordProxy<T>
BeanRecordProxy This class defines proxy that allows any POJO to behave like a record object.
Field Summary | |
---|---|
protected List<Column> |
columns
|
protected T |
data
|
protected Column[] |
keyColumns
|
protected static org.slf4j.Logger |
log
|
protected boolean[] |
modified
|
Constructor Summary | |
---|---|
BeanRecordProxy(BeanClass beanClass)
|
|
BeanRecordProxy(List<Column> columns,
Column[] keyColumns)
|
|
BeanRecordProxy(T data,
BeanClass beanClass)
|
|
BeanRecordProxy(T data,
List<Column> columns,
Column[] keyColumns)
|
Method Summary | |
---|---|
void |
clearModified()
clears the modification status of the object and all fields. |
T |
getBean()
|
int |
getBeanProperties(Object bean)
copies all field values into a static Java Bean. |
int |
getBeanProperties(Object bean,
Collection<ColumnExpr> ignoreList)
copies all field values into a static Java Bean. |
protected Object |
getBeanPropertyValue(Object bean,
ColumnExpr column)
|
protected Object |
getBeanPropertyValue(Object bean,
String property)
|
Column |
getColumn(int index)
returns the column at the specified index. |
ColumnExpr |
getColumnExpr(int index)
returns the column expression for a given column This is the reverse operation of getFieldIndex() |
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. |
Column[] |
getKeyColumns()
returns an array of key columns which uniquely identify the record. |
Object[] |
getKeyValues()
Returns the array of primary key columns. |
Object |
getValue(ColumnExpr column)
returns the record value for a particular column |
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. |
void |
setBean(T data)
|
protected void |
setBeanPropertyValue(Object bean,
Column column,
Object value)
|
int |
setBeanValues(Object bean)
sets all record values from a particular bean. |
int |
setBeanValues(Object bean,
Collection<Column> ignoreList)
sets all record values from a particular bean. |
void |
setValue(Column column,
Object value)
sets the value of a field. |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final org.slf4j.Logger log
protected List<Column> columns
protected Column[] keyColumns
protected boolean[] modified
protected T data
Constructor Detail |
---|
public BeanRecordProxy(T data, List<Column> columns, Column[] keyColumns)
public BeanRecordProxy(List<Column> columns, Column[] keyColumns)
public BeanRecordProxy(T data, BeanClass beanClass)
public BeanRecordProxy(BeanClass beanClass)
Method Detail |
---|
public T getBean()
public void setBean(T data)
public Column getColumn(int index)
Record
getColumn
in interface Record
index
- index of a requested column
public ColumnExpr getColumnExpr(int index)
RecordData
getColumnExpr
in interface RecordData
index
- field index of the column expression
public Column[] getKeyColumns()
Record
getKeyColumns
in interface Record
public Object[] getKeyValues()
public int getFieldCount()
RecordData
getFieldCount
in interface RecordData
public int getFieldIndex(ColumnExpr column)
RecordData
getFieldIndex
in interface RecordData
column
- the column for which to return the index
public int getFieldIndex(String columnName)
RecordData
getFieldIndex
in interface RecordData
columnName
- the name of the column for which to return the index
public Options getFieldOptions(Column column)
Record
getFieldOptions
in interface Record
column
- the column to check for visibility
public boolean isFieldVisible(Column column)
Record
isFieldVisible
in interface Record
column
- the column to check for visibility
public boolean isFieldReadOnly(Column column)
Record
isFieldReadOnly
in interface Record
column
- the requested column
public boolean isFieldRequired(Column column)
Record
isFieldRequired
in interface Record
column
- the requested column
public boolean isModified()
Record
isModified
in interface Record
public boolean isNew()
Record
isNew
in interface Record
public boolean isValid()
Record
isValid
in interface Record
public boolean isReadOnly()
Record
isReadOnly
in interface Record
public Object getValue(ColumnExpr column)
RecordData
getValue
in interface RecordData
column
- the column for which to return the value
public Object getValue(int index)
RecordData
getValue
in interface RecordData
index
- the field index for which to return the value
public boolean isNull(ColumnExpr column)
RecordData
isNull
in interface RecordData
column
- the column
public boolean isNull(int index)
RecordData
isNull
in interface RecordData
index
- the field index
public Object validateValue(Column column, Object value)
validateValue
in interface Record
column
- the columnvalue
- the value to validate
public void setValue(Column column, Object value)
setValue
in interface Record
column
- the requested columnvalue
- the new record value for the given columnpublic final void setValue(int i, Object value)
setValue
in interface Record
i
- index of the field for which to set the valuevalue
- the new field valuepublic boolean wasModified(Column column)
wasModified
in interface Record
column
- the requested column
public void clearModified()
public int getBeanProperties(Object bean)
RecordData
In order to map column names to property names the property name is detected by ColumnExpr.getBeanPropertyName()
getBeanProperties
in interface RecordData
bean
- the Java Bean for which to set the propertiespublic int getBeanProperties(Object bean, Collection<ColumnExpr> ignoreList)
RecordData
In order to map column names to property names the property name is detected by ColumnExpr.getBeanPropertyName()
getBeanProperties
in interface RecordData
bean
- the Java Bean for which to set the propertiesignoreList
- list of columns to skip (optional)public int setBeanValues(Object bean, Collection<Column> ignoreList)
Record
The 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()
setBeanValues
in interface Record
bean
- the Java Bean from which to read the value fromignoreList
- list of column to ignore
public int setBeanValues(Object bean)
Record
The bean must provide corresponding getter functions for all desired column.
setBeanValues
in interface Record
bean
- the Java Bean from which to read the value from
protected Object getBeanPropertyValue(Object bean, ColumnExpr column)
protected Object getBeanPropertyValue(Object bean, String property)
protected void setBeanPropertyValue(Object bean, Column column, Object value)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |