Package i5.las2peer.serialization
Interface XmlAble
- All Known Implementing Classes:
AgentImpl
,AnonymousAgentImpl
,BotAgent
,EnvelopeVersion
,EthereumAgent
,EthereumGroupAgent
,GroupAgentImpl
,LoadedNetworkLibrary
,Message
,MonitoringAgent
,NodeInformation
,PassphraseAgentImpl
,ServiceAgentImpl
,TestAgent
,UserAgentImpl
public interface XmlAble
The old XmlAble interface enforced an setStateFromXmlMethod.
Due to several problems I decided to remove this method and leave the deserialization in the hand of the
programmer.
If standard methods are to be used, the programmer of an XmlAble class should used one of the following methods
- Use a factory called createFromXml ( String xml )
This is the preferred idea. An interface may not enforce static methods however... - Use a Constructor with a single String parameter
- Use a base constructor in combination with setStateFromXml ( String )
This corresponds to the old XmlAble.
-
Method Summary
Modifier and TypeMethodDescriptionstatic XmlAble
createFromXml
(String xml, Class<?> c) this method goes through the three possible standard deserialization methods defined inXmlAble
to try to deserialize an XmlString into an instance of the given classstatic XmlAble
createFromXml
(String xml, String classname) create an XmlAble java object from its xml representationReturns a XML representation of this object.
-
Method Details
-
createFromXml
static XmlAble createFromXml(String xml, String classname) throws MalformedXMLException, SerializationException, ClassNotFoundException create an XmlAble java object from its xml representation- Parameters:
xml
-classname
-- Returns:
- deserialized object
- Throws:
MalformedXMLException
SerializationException
ClassNotFoundException
-
createFromXml
static XmlAble createFromXml(String xml, Class<?> c) throws MalformedXMLException, SerializationException this method goes through the three possible standard deserialization methods defined inXmlAble
to try to deserialize an XmlString into an instance of the given class- Parameters:
xml
-c
-- Returns:
- deserialized object
- Throws:
MalformedXMLException
SerializationException
-
toXmlString
Returns a XML representation of this object.- Returns:
- a XML String representation
- Throws:
SerializationException
-