|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | 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. they form an adapter between the actual object and the format SIXBS can process.
If you are serializing an object that has an adapter, the 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-argument constructor and a one argument
constructor. The argument must be of the type the adapter is adapting to.
The adapter class must be named [classname]Adapt
and has to be located
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 must have a no argument constructor.
AdapterFinder
Field Summary | |
static java.lang.String |
vcid
Source-Version |
Method Summary | |
java.lang.Object |
deserialize()
Returns the object that has been initialized from XML by calling the setter methods of a class implementing this interface. |
Field Detail |
public static final java.lang.String vcid
Method Detail |
public java.lang.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
.
SIXBSException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |