submarine.connectors
Class ContextSerializer
java.lang.Object
|
+--submarine.connectors.ContextSerializer
- All Implemented Interfaces:
- Serializer, SerializerWithContext, XMLConfigurable
- public class ContextSerializer
- extends java.lang.Object
- implements SerializerWithContext
This class set attributes in the context using the XML document given or build by the
inner Serializer.
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
attributes
private java.util.Hashtable attributes
serializer
private Serializer serializer
context
private Message.MsgContext context
ContextSerializer
public ContextSerializer()
init
public void init(org.w3c.dom.Element xml)
throws java.lang.Exception
- Syntaxe XML attendue.
<serializer> <!-- Le nom de l'élément n'est pas testé ici -->
<Serializer class="package.class"/>
<attributes>
<!-- value-of elements are evaluated with the XML document given or
build by the parser/serializer -->
<attribute name="attname">some texte with <value-of/> elements
</attribute>
<attribute name="attname2">some texte with <value-of/> elements
</attribute>
</attributes>
</serializer>
- Specified by:
init
in interface XMLConfigurable
- Following copied from interface:
submarine.core.XMLConfigurable
- Parameters:
xml
- - Throws:
java.lang.Exception
-
setContext
private void setContext(org.w3c.dom.Document doc,
Message.MsgContext context)
serializeObject
public org.w3c.dom.Document serializeObject(java.lang.Object obj,
Message.MsgContext context)
throws java.lang.Exception
- Specified by:
serializeObject
in interface SerializerWithContext
serializeObject
public org.w3c.dom.Document serializeObject(java.lang.Object obj)
throws java.lang.Exception
- Description copied from interface:
Serializer
- Transforme un object java en un document XML.
- Specified by:
serializeObject
in interface Serializer
- Following copied from interface:
submarine.core.Serializer
- Parameters:
obj
- l'object à transformer- Returns:
- org.w3c.dom.Document Le document XML résultat.
- Throws:
java.lang.Exception
- Une exception doit être levée si le Serializer ne
sait pas transformer ce type d'objet java.
serializeXML
public java.lang.Object serializeXML(org.w3c.dom.Document doc,
Message.MsgContext context)
throws java.lang.Exception
- Specified by:
serializeXML
in interface SerializerWithContext
serializeXML
public java.lang.Object serializeXML(org.w3c.dom.Document doc)
throws java.lang.Exception
- Description copied from interface:
Serializer
- Transforme un document XML en object Java.
- Specified by:
serializeXML
in interface Serializer
- Following copied from interface:
submarine.core.Serializer
- Parameters:
doc
- Le document XML contenant les informations décrivant l'objet.- Returns:
- java.lang.Object L'object Java initialisé avec le document XML.
- Throws:
java.lang.Exception
- Lève une exception si la syntaxe attendue pour le
document XML n'est pas respectée.