Class JacksonEventSerializer

java.lang.Object
org.springframework.modulith.events.jackson.JacksonEventSerializer
All Implemented Interfaces:
EventSerializer

class JacksonEventSerializer extends Object implements EventSerializer
A Jackson-based EventSerializer.
Author:
Oliver Drotbohm
  • Constructor Details

    • JacksonEventSerializer

      public JacksonEventSerializer(Supplier<com.fasterxml.jackson.databind.ObjectMapper> mapper)
      Creates a new JacksonEventSerializer for the given ObjectMapper.
      Parameters:
      mapper - must not be null.
  • Method Details

    • serialize

      public Object serialize(Object event)
      Description copied from interface: EventSerializer
      Serializes the given event into a storable format.
      Specified by:
      serialize in interface EventSerializer
      Parameters:
      event - must not be null.
      Returns:
      will never be null.
    • deserialize

      public <T> T deserialize(Object serialized, Class<T> type)
      Description copied from interface: EventSerializer
      Deserializes the event from the serialization format into an instance of the given type.
      Specified by:
      deserialize in interface EventSerializer
      Parameters:
      serialized - must not be null.
      type - must not be null.
      Returns:
      will never be null.