Interface MessageConverter

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

public interface MessageConverter extends Converter
A converter specific for Messages, 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 Converter instance.

Since:
5.0.0
Author:
Steven van Beelen
  • Method Summary

    Modifier and Type
    Method
    Description
    default <M extends Message, T>
    M
    convertMessage(M message, Class<T> targetType)
    Converts the given message's payload to the given targetType, returning a new Message with the converted payload.
    <M extends Message>
    M
    convertMessage(M message, Type targetType)
    Converts the given message's payload to the given targetType, returning a new Message with the converted payload.
    default <M extends Message, T>
    @Nullable T
    convertPayload(M message, Class<T> targetType)
    Converts the given message's payload into a payload of the given targetType.
    <M extends Message, T>
    @Nullable T
    convertPayload(M message, Type targetType)
    Converts the given message'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 <M extends Message, T> @Nullable T convertPayload(M message, Class<T> targetType)
      Converts the given message's payload into a payload of the given targetType.
      Type Parameters:
      M - The type of Message to convert the payload for.
      T - The target data type.
      Parameters:
      message - The Message to convert the payload for.
      targetType - The type to convert the payload into.
      Returns:
      A converted version of the given Message's payload into the given targetType.
    • convertPayload

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

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

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