Interface Converter

All Superinterfaces:
DescribableComponent
All Known Subinterfaces:
EventConverter, MessageConverter
All Known Implementing Classes:
AvroConverter, ChainingContentTypeConverter, DelegatingEventConverter, DelegatingMessageConverter, Jackson2Converter, JacksonConverter, PassThroughConverter

public interface Converter extends DescribableComponent
Interface describing a mechanism that can convert data from one to another type.

Used when object are added/retrieved from a storage solution or put on/received from a network. Clear example of this is the org.axonframework.messaging.core.Message.

Since:
3.0.0
Author:
Allard Buijze, Rene de Waele
  • Method Summary

    Modifier and Type
    Method
    Description
    default <T> @Nullable T
    convert(@Nullable Object input, Class<T> targetType)
    Converts the given input object into an object of the given targetType.
    <T> @Nullable T
    convert(@Nullable Object input, Type targetType)
    Converts the given input object into an object of the given targetType.

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

    describeTo
  • Method Details

    • convert

      default <T> @Nullable T convert(@Nullable Object input, Class<T> targetType)
      Converts the given input object into an object of the given targetType.
      Type Parameters:
      T - The target data type.
      Parameters:
      input - The value to convert.
      targetType - The type to convert the given input into.
      Returns:
      A converted version of the given input into the given targetType.
      Throws:
      ConversionException - If the input cannot be converted to the given targetType.
    • convert

      <T> @Nullable T convert(@Nullable Object input, Type targetType)
      Converts the given input object into an object of the given targetType.
      Type Parameters:
      T - The target data type.
      Parameters:
      input - The value to convert.
      targetType - The type to convert the given input into.
      Returns:
      A converted version of the given input into the given targetType.
      Throws:
      ConversionException - If the input cannot be converted to the given targetType.