Interface Encoder<From,To>

Type Parameters:
From - the type of object to encode
To - the type of the encoded object
All Known Subinterfaces:
CompoundEncoder<From,To>, Converter<A,B>, JoinableEncoder<From,To>, JoinablePrimitiveEncoder<To>, MediaTypeConverter<From>, ObjectConverter<From>, PrimitiveEncoder<To>, ReactiveConverter<A,B>, ReactiveEncoder<From,To>
All Known Implementing Classes:
ByteBufConverter, CompositeConverter, CompositeEncoder, JacksonByteBufConverter, JacksonStringConverter, JsonByteBufMediaTypeConverter, JsonStringMediaTypeConverter, NdJsonByteBufMediaTypeConverter, NdJsonStringMediaTypeConverter, ParameterConverter, StringCompositeConverter, StringConverter, TextByteBufMediaTypeConverter, TextStringMediaTypeConverter

public interface Encoder<From,To>

An encoder is used to encode an object into another object.

Since:
1.0
Author:
Jeremy Kuhn
  • Method Summary

    Modifier and Type
    Method
    Description
    <T extends From>
    To
    encode(T value)
    Encodes the specified value to the encoded type.
    <T extends From>
    To
    encode(T value, Class<T> type)
    Encodes the specified value whose type is represented by the specified class to the encoded type.
    <T extends From>
    To
    encode(T value, Type type)
    Encodes the specified value whose type is the specified type to the encoded type.
  • Method Details

    • encode

      <T extends From> To encode(T value) throws ConverterException

      Encodes the specified value to the encoded type.

      Type Parameters:
      T - the type of the decoded object
      Parameters:
      value - the object to encode
      Returns:
      an encoded object
      Throws:
      ConverterException - if there was an error encoding the value
    • encode

      <T extends From> To encode(T value, Class<T> type) throws ConverterException

      Encodes the specified value whose type is represented by the specified class to the encoded type.

      Type Parameters:
      T - the type of the decoded object
      Parameters:
      value - the object to encode
      type - the class of the decoded object
      Returns:
      an encoded object
      Throws:
      ConverterException - if there was an error encoding the value
    • encode

      <T extends From> To encode(T value, Type type) throws ConverterException

      Encodes the specified value whose type is the specified type to the encoded type.

      Type Parameters:
      T - the type of the decoded object
      Parameters:
      value - the object to encode
      type - the type of the decoded object
      Returns:
      an encoded object
      Throws:
      ConverterException - if there was an error encoding the value