|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
If you want to serialize objects that do not comply to the java beans conventions or objects that were provided by a third party, you should write an Adapter.
Adapters are classes that hold the object you want to serialize. They expose properties through methods, that are easily serializable by SIXBS. I.e. form an adapter between the actual object and the format SIXBS can process.
If you try to write an object that has an adapter, this adapter is instantiated and then the Adapter is written, not the object. When you read a serialized Adapter, it instantiates the original object, sets all necessary properties and returns the object, not the adapter.
A class implementing this interface must have a no arg constructor and a one arg
constructor. The arg must be of the type the adapter is adapting to.
The adapter class must be named [classname]Adapt and has to be present
in the adapter searchpath (see AdapterFinder).
SIXBS will use the get and set methods of the adapter to (de)serialize the bean. Beans using this mechanism have to have a no arg constructor.
AdapterFinder| Field Summary | |
static String |
vcid
Source-Version |
| Method Summary | |
Object |
deserialize()
Returns the object that has been initialized from XML by calling the setter methods of a class implementing this interface. Example: In ArrayListAdapt this method
returns an initialized ArrayList. |
| Field Detail |
public static final String vcid
| Method Detail |
public Object deserialize()
throws SIXBSException
Example:
In ArrayListAdapt this method
returns an initialized ArrayList. The ArrayList
has been initialized by the Adapter, when the
ListAdapt.setList(Object[])
method was called by SIXBSReader.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||