Interface Converter<I,O>

Type Parameters:
I - the input data format type
O - the output data format type
All Known Subinterfaces:
Inverter<T>
All Known Implementing Classes:
AbstractConverter, JacksonInverter

public interface Converter<I,O>
Interface for converting Data objects from one format or representation to another.

Converters are typically used to transform serialized data—e.g., for encoding changes, compression, encryption, or changing the representation format (such as JSON to binary).

  • Method Summary

    Modifier and Type
    Method
    Description
    convert(Data<I> data)
    Converts the given Data from input type I to output type O.
    default Data<?>
    Optionally converts the structure or format (e.g.: application/json) of the input data without modifying its core content.
     
  • Method Details

    • convert

      Data<O> convert(Data<I> data)
      Converts the given Data from input type I to output type O.
      Parameters:
      data - the input data
      Returns:
      the converted data
    • convertFormat

      default Data<?> convertFormat(Data<I> data)
      Optionally converts the structure or format (e.g.: application/json) of the input data without modifying its core content.

      This method is used in scenarios where only a format change is required (e.g., wrapping metadata differently), and may return the original input or a modified version depending on the implementation.

      Parameters:
      data - the input data
      Returns:
      the format-converted data, or the original input (default implementation)
    • getOutputType

      Class<O> getOutputType()
      Returns:
      the target output type this converter produces