Class AbstractConverter<I,O>

java.lang.Object
io.fluxcapacitor.common.serialization.AbstractConverter<I,O>
Type Parameters:
I - the type of the input data to be converted
O - the type of the output data after the conversion
All Implemented Interfaces:
Converter<I,O>

public abstract class AbstractConverter<I,O> extends Object implements Converter<I,O>
An abstract base class for converting data of type I to type O. This class implements the Converter interface and provides a default behavior for the convert(Data) method, while requiring subclasses to define their own implementation for converting input values of type I to output values of type O.
  • Constructor Details

    • AbstractConverter

      public AbstractConverter()
  • Method Details

    • convert

      public Data<O> convert(Data<I> data)
      Description copied from interface: Converter
      Converts the given Data from input type I to output type O.
      Specified by:
      convert in interface Converter<I,O>
      Parameters:
      data - the input data
      Returns:
      the converted data
    • convert

      protected abstract O convert(I bytes)
    • getOutputType

      public Class<O> getOutputType()
      Specified by:
      getOutputType in interface Converter<I,O>
      Returns:
      the target output type this converter produces