Package energy.eddie.cim.serde
Class XmlMessageSerde
java.lang.Object
energy.eddie.cim.serde.XmlMessageSerde
- All Implemented Interfaces:
MessageSerde
A
MessageSerde implementation that produces CIM compliant XML.
Can also serialize and deserialize unknown types to and from XML.
Uses the JAXB for CIM documents and ObjectMapper as fallback.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> Tdeserialize(byte[] message, Class<T> messageType) Deserializes a message to a given class.<T> List<T> deserializeList(byte[] message, Class<T> elementType) Deserializes a message to a list of elements based on the given elementType.byte[]Serializes an object to a byte array.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface energy.eddie.cim.serde.MessageSerde
deserialize, deserializeList
-
Constructor Details
-
XmlMessageSerde
- Throws:
SerdeInitializationException
-
-
Method Details
-
serialize
Description copied from interface:MessageSerdeSerializes an object to a byte array.- Specified by:
serializein interfaceMessageSerde- Parameters:
message- the object to be serialized.- Returns:
- a serialized byte array
- Throws:
SerializationException- if the serialization failed
-
deserialize
Description copied from interface:MessageSerdeDeserializes a message to a given class.- Specified by:
deserializein interfaceMessageSerde- Type Parameters:
T- the destination type.- Parameters:
message- the message that should be deserialized.messageType- the class of the destination type.- Returns:
- the deserialized object.
- Throws:
DeserializationException- if the deserialization fails.
-
deserializeList
public <T> List<T> deserializeList(byte[] message, Class<T> elementType) throws DeserializationException Description copied from interface:MessageSerdeDeserializes a message to a list of elements based on the given elementType.- Specified by:
deserializeListin interfaceMessageSerde- Type Parameters:
T- the element type.- Parameters:
message- the message that should be deserialized.elementType- the type of the elements of the destination list.- Returns:
- the deserialized list.
- Throws:
DeserializationException- if the deserialization fails.
-