|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.ricebridge.xmlman.RecordListenerSupport
com.ricebridge.xmlman.BeanRecordListener
Implementation of RecordListener that stores data records as
a List of Java Beans.
This class is used to implement the loadBeans(*,RecordSpec,BeanSpec)
methods in XmlManager.
Data records are stored in new instances of Java Bean objects by calling the property set methods
of the objects in accordance with the Java Beans specification. Ordinary, boolean and indexed properties are supported.
See the BeanSpec documentation for more information.
BeanRecordListener is designed to be subclassed. You can change the default implementation by calling the
setBeanRecordListenerClass method of
XmlManagerStore, and providing a subclass of BeanRecordListener.
XmlManagerStore can be accessed using XmlManager.getXmlManagerStore().
The Source Code of this Java class is available under a BSD-style license.
| Field Summary | |
protected ArrayList |
iBeans
List of beans loaded. |
protected BeanSpec |
iBeanSpec
BeanSpec specification object defining the properties of the beans to load. |
protected boolean |
iUseDefault
If a data field is empty, use the default value of the property for that field data type. |
static String |
PROP_Bean_useDefault
Specify that empty data fields have the default value for their data type (name for XmlSpec.setProperty: Bean.useDefault). |
| Fields inherited from class com.ricebridge.xmlman.RecordListenerSupport |
iFieldNames |
| Constructor Summary | |
BeanRecordListener()
Constructor with no parameters required for creating new objects in XmlManagerStore.newBeanRecordListener. |
|
| Method Summary | |
List |
getBeans()
Get the data records as List of Java Bean objects. |
protected BadRecord |
handleBean(Object pBean)
Store a bean object in the list of beans. |
protected BadRecord |
handleRecordImpl(String[] pRecord,
long pRecordNumber)
Store the data record String[]. |
protected Object |
makeBean(String[] pRecord)
Create a new instance of the bean specified by the BeanSpec
and sets the bean properties data from the record String[] array. |
void |
setBeanSpec(BeanSpec pBeanSpec)
Set the BeanSpec object that defines the beans to load. |
protected void |
setXmlSpecImpl(XmlSpec pXmlSpec)
Handle property settings for loading Java Bean. |
protected void |
startProcessImpl()
Start the load process. |
String |
toString()
Return a textual description suitable for debugging. |
| Methods inherited from class com.ricebridge.xmlman.RecordListenerSupport |
endProcess, endProcessImpl, handleRecord, setFieldNames, setFieldNamesImpl, setXmlSpec, startProcess |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final String PROP_Bean_useDefault
XmlSpec.setProperty: Bean.useDefault).
protected ArrayList iBeans
protected BeanSpec iBeanSpec
BeanSpec specification object defining the properties of the beans to load.
protected boolean iUseDefault
| Constructor Detail |
public BeanRecordListener()
XmlManagerStore.newBeanRecordListener.
| Method Detail |
public void setBeanSpec(BeanSpec pBeanSpec)
BeanSpec object that defines the beans to load.
The BeanSpec object contains the definitions of the
bean properties and performs the conversion from String values to internal Java data types.
pBeanSpec - BeanSpec definition of beans to loadpublic List getBeans()
List of Java Bean objects.
List of beanspublic String toString()
protected void setXmlSpecImpl(XmlSpec pXmlSpec)
You can change these using XmlSpec.
setXmlSpecImpl in class RecordListenerSupportpXmlSpec - XML specificationRecordListener.setXmlSpec(com.ricebridge.xmlman.XmlSpec),
PROP_Bean_useDefaultprotected void startProcessImpl()
Performs some sanity checks on the loading setup.
startProcessImpl in class RecordListenerSupportRecordListenerSupport.startProcess(),
RecordListener.startProcess()
protected BadRecord handleRecordImpl(String[] pRecord,
long pRecordNumber)
throws Exception
String[].
handleRecordImpl in class RecordListenerSupportpRecord - record data as a String[]pRecordNumber - current count of records
ExceptionRecordListener.handleRecord(java.lang.String[], long)protected BadRecord handleBean(Object pBean)
pBean - bean objectprotected Object makeBean(String[] pRecord)
BeanSpec
and sets the bean properties data from the record String[] array.
pRecord - record data
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||