Interface EventConverter

All Superinterfaces:
Converter, DescribableComponent
All Known Implementing Classes:
DelegatingEventConverter

public interface EventConverter extends Converter
A converter specific for EventMessages, acting on the payload.

This interface serves the purpose of enforcing use of the right type of converter. Implementation of this interface typically delegate operations to a MessageConverter instance, unless the serialized format of events and other messages differ.

Since:
5.0.0
Author:
Steven van Beelen
  • Method Summary

    Modifier and Type
    Method
    Description
    default <E extends EventMessage, T>
    E
    convertEvent(E event, Class<T> targetType)
    Converts the given event's payload to the given targetType, returning a new EventMessage with the converted payload.
    <E extends EventMessage>
    E
    convertEvent(E event, Type targetType)
    Converts the given event's payload to the given targetType, returning a new EventMessage with the converted payload.
    default <E extends EventMessage, T>
    @Nullable T
    convertPayload(E event, Class<T> targetType)
    Converts the given event's payload into a payload of the given targetType.
    <E extends EventMessage, T>
    @Nullable T
    convertPayload(E event, Type targetType)
    Converts the given event's payload into a payload of the given targetType.

    Methods inherited from interface org.axonframework.conversion.Converter

    convert, convert

    Methods inherited from interface org.axonframework.common.infra.DescribableComponent

    describeTo
  • Method Details

    • convertPayload

      default <E extends EventMessage, T> @Nullable T convertPayload(E event, Class<T> targetType)
      Converts the given event's payload into a payload of the given targetType.
      Type Parameters:
      E - The type of EventMessage to convert the payload for.
      T - The target data type.
      Parameters:
      event - The EventMessage to convert the payload for.
      targetType - The type to convert the payload into.
      Returns:
      A converted version of the given EventMessage's payload into the given targetType.
    • convertPayload

      <E extends EventMessage, T> @Nullable T convertPayload(E event, Type targetType)
      Converts the given event's payload into a payload of the given targetType.
      Type Parameters:
      E - The type of EventMessage to convert the payload for.
      T - The target data type.
      Parameters:
      event - The EventMessage to convert the payload for.
      targetType - The type to convert the payload into.
      Returns:
      A converted version of the given EventMessage's payload into the given targetType.
    • convertEvent

      default <E extends EventMessage, T> E convertEvent(E event, Class<T> targetType)
      Converts the given event's payload to the given targetType, returning a new EventMessage with the converted payload.
      Type Parameters:
      E - The type of EventMessage to convert and return.
      T - The target data type.
      Parameters:
      event - The EventMessage to convert the payload for.
      targetType - The type to convert the payload into.
      Returns:
      A new EventMessage containing the converted version of the given event's payload into the given targetType.
    • convertEvent

      <E extends EventMessage> E convertEvent(E event, Type targetType)
      Converts the given event's payload to the given targetType, returning a new EventMessage with the converted payload.
      Type Parameters:
      E - The type of EventMessage to convert and return.
      Parameters:
      event - The EventMessage to convert the payload for.
      targetType - The type to convert the payload into.
      Returns:
      A new EventMessage containing the converted version of the given event's payload into the given targetType.