Class DefaultSerializerDeserializer

java.lang.Object
io.micronaut.jms.serdes.DefaultSerializerDeserializer
All Implemented Interfaces:
Deserializer, Serializer

@Singleton public final class DefaultSerializerDeserializer extends Object implements Serializer, Deserializer
Default implementation of Serializer and Deserializer. It is the default implementation of both types, so applications can add named serializers and deserializers for the serializer and deserializer members of @Queue and @Topic, and can still replace the global one with a @Primary bean, a bean with a higher precedence @Order, or @Replaces(DefaultSerializerDeserializer.class).
Since:
1.0.0
Author:
Elliott Pope
  • Constructor Details

    • DefaultSerializerDeserializer

      public DefaultSerializerDeserializer(io.micronaut.context.BeanLocator beanLocator)
  • Method Details

    • deserialize

      public <T> T deserialize(jakarta.jms.Message message, Class<T> clazz)
      Description copied from interface: Deserializer
      Extract the body of the message into the specified type.
      Specified by:
      deserialize in interface Deserializer
      Type Parameters:
      T - the type
      Parameters:
      message - the message
      clazz - the type
      Returns:
      the extracted message body as an instance of the specified type
    • deserialize

      public <T> T deserialize(jakarta.jms.Message message, io.micronaut.core.type.Argument<T> argument)
      Description copied from interface: Deserializer
      Extract the body of the message into the specified type.

      The default implementation delegates to Deserializer.deserialize(Message, Class) and only uses TypeInformation.getType(), so it does not preserve type variables. Implementers should override this method to support generic-aware deserialization.

      Specified by:
      deserialize in interface Deserializer
      Type Parameters:
      T - the type
      Parameters:
      message - the message
      argument - the argument
      Returns:
      the extracted message body as an instance of the specified type
    • serialize

      public jakarta.jms.Message serialize(jakarta.jms.Session session, Object body)
      Description copied from interface: Serializer
      Create a message from the body.
      Specified by:
      serialize in interface Serializer
      Parameters:
      session - the JMS session
      body - the message body
      Returns:
      the message