Interface MessageSerde

All Known Implementing Classes:
JsonMessageSerde, XmlMessageSerde

public interface MessageSerde
A serde is a SERializer-DEserializer, which supports one or multiple formats to serialize and deserialize objects to and from.
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    deserialize(byte[] message, Class<T> messageType)
    Deserializes a message to a given class.
    byte[]
    serialize(Object message)
    Serializes an object to a byte array.
  • Method Details

    • serialize

      byte[] serialize(Object message) throws SerializationException
      Serializes an object to a byte array.
      Parameters:
      message - the object to be serialized.
      Returns:
      a serialized byte array
      Throws:
      SerializationException - if the serialization failed
    • deserialize

      <T> T deserialize(byte[] message, Class<T> messageType) throws DeserializationException
      Deserializes a message to a given class.
      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.