|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ComponentSerializer
Interface that describes the (de)serializer of a component. Classes derived from this interface must be stateless! This is to avoid the creation of a new serializer object for each XML element.
Method Summary | |
---|---|
void |
addUsedClasses(java.lang.Class base,
java.util.Set usedClasses)
Get all classes used by a given base class. |
java.lang.Object |
endDeserialize(java.lang.Object obj,
java.lang.String text)
This method is called during deserialization when the end of the element is found. |
java.lang.String |
getXMLTypeName()
Get the XML type name for objects handled by the serializer. |
void |
serialize(java.lang.Object obj,
java.lang.Class type,
java.lang.String name,
java.util.Map propertyMap,
java.util.Map objectIdMap,
DocumentOutputHandlerInterface output)
Serialize an object. |
void |
setMember(java.lang.Object parent,
java.lang.String name,
java.lang.Object value)
This method is called when a member field of an object was completely deserialized and needs to be set. |
java.lang.Object |
startDeserialize(java.lang.String name,
org.xml.sax.Attributes attrs,
java.lang.Object parent,
java.util.Stack objHolderStack,
java.lang.ClassLoader classLoader)
This method is called during deserialization when the start of an element is found. |
void |
toJson(java.lang.Object obj,
java.lang.Class type,
java.util.Map propertyMap,
java.io.PrintStream output)
Serialize an object to JSON. |
void |
writeXMLTypeDefinition(java.lang.Class type,
java.util.Map propertyMap,
DocumentOutputHandlerInterface output)
Write the definition the type in XML Schema format. |
Method Detail |
---|
void serialize(java.lang.Object obj, java.lang.Class type, java.lang.String name, java.util.Map propertyMap, java.util.Map objectIdMap, DocumentOutputHandlerInterface output) throws SerializerException
obj
- The object to serialize.type
- The type of the object.name
- The name of the object.propertyMap
- A map (string-to-object) of properties for serialization.objectIdMap
- The objects and their ids that were already serialized.output
- The destination of the serialization.
SerializerException
- If an error occured during serialization.java.lang.Object startDeserialize(java.lang.String name, org.xml.sax.Attributes attrs, java.lang.Object parent, java.util.Stack objHolderStack, java.lang.ClassLoader classLoader) throws DeserializerException
name
- The name of the element.attrs
- The attributes of the XML element.parent
- The parent object or null if unknown.objHolderStack
- The complete stack of all parent ObjectDeserializerHolder objects.classLoader
- The class loader used to load the class of the new object.
DeserializerException
- If the creation of the object failed.java.lang.Object endDeserialize(java.lang.Object obj, java.lang.String text) throws DeserializerException
obj
- The element created by startDeserialize.text
- The text child node of the XML element.
DeserializerException
- If the deserialization failed.void setMember(java.lang.Object parent, java.lang.String name, java.lang.Object value) throws DeserializerException, java.lang.NoSuchFieldException
parent
- The parent object.name
- The name of the member.value
- The value of the member.
DeserializerException
- If the setting of the member failed.
java.lang.NoSuchFieldException
- If the object doesn't have a member
with the specified name.java.lang.String getXMLTypeName()
void writeXMLTypeDefinition(java.lang.Class type, java.util.Map propertyMap, DocumentOutputHandlerInterface output) throws SerializerException
type
- The type of the object.propertyMap
- A map (string-to-object) of properties.output
- Where to write the schema definition to.
SerializerException
- If an error occured during write.void addUsedClasses(java.lang.Class base, java.util.Set usedClasses) throws SerializerException
base
- The base class.usedClasses
- A Set with Class objects which represent
all used classes. This set is filled up by this function.
SerializerException
- If an error occured.void toJson(java.lang.Object obj, java.lang.Class type, java.util.Map propertyMap, java.io.PrintStream output) throws SerializerException
obj
- The object to serialize.type
- The type of the object.propertyMap
- A map (string-to-object) of properties for serialization.output
- The destination of the serialization.
SerializerException
- If an error occurred during serialization.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |