Package org.dellroad.stuff.pobj
Class SpringDelegate<T>
java.lang.Object
org.dellroad.stuff.pobj.AbstractDelegate<T>
org.dellroad.stuff.pobj.SpringDelegate<T>
- Type Parameters:
T
- type of the root persistent object
- All Implemented Interfaces:
PersistentObjectDelegate<T>
,InitializingBean
PersistentObjectDelegate
that uses Spring's Marshaller
and Unmarshaller
interfaces
for XML conversion.-
Field Summary
Fields inherited from class org.dellroad.stuff.pobj.AbstractDelegate
log
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
deserialize
(Source source) Deserialize a root object graph from XML.void
Serialize a root object graph into XML.void
setMarshaller
(Marshaller marshaller) Set theMarshaller
used to convert instances to XML.void
setUnmarshaller
(Unmarshaller unmarshaller) Set theMarshaller
used to convert instances to XML.Methods inherited from class org.dellroad.stuff.pobj.AbstractDelegate
copy, getDefaultValue, handleWritebackException, isSameGraph, validate
-
Constructor Details
-
SpringDelegate
public SpringDelegate()
-
-
Method Details
-
setMarshaller
Set theMarshaller
used to convert instances to XML. Required property.- Parameters:
marshaller
- XML marshaller
-
setUnmarshaller
Set theMarshaller
used to convert instances to XML. Required property.- Parameters:
unmarshaller
- XML unmarshaller
-
afterPropertiesSet
- Specified by:
afterPropertiesSet
in interfaceInitializingBean
- Throws:
Exception
-
serialize
Description copied from interface:PersistentObjectDelegate
Serialize a root object graph into XML.Note that this method effectively defines what is contained in the object graph rooted at
obj
.This method must not modify
obj
or any other object in its object graph.- Specified by:
serialize
in interfacePersistentObjectDelegate<T>
- Parameters:
obj
- object to serialize; must not be modifiedresult
- XML destination- Throws:
IOException
- if an I/O error occurs
-
deserialize
Description copied from interface:PersistentObjectDelegate
Deserialize a root object graph from XML.This method also presents an opportunity to (re)construct any indexes used for optimizing queries into the root object graph.
- Specified by:
deserialize
in interfacePersistentObjectDelegate<T>
- Parameters:
source
- XML source- Returns:
- deserialized object
- Throws:
IOException
- if an I/O error occurs
-