Package energy.eddie.cim.serde
Class JsonMessageSerde
java.lang.Object
energy.eddie.cim.serde.JsonMessageSerde
- All Implemented Interfaces:
MessageSerde
A
MessageSerde that serializes to JSON.
Respects jakarta XML annotation.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> Tdeserialize(byte[] message, Class<T> messageType) Deserializes a message to a given class.byte[]Serializes an object to a byte array.
-
Constructor Details
-
JsonMessageSerde
public JsonMessageSerde()
-
-
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.
-