Interface Encoder<T,S>

Type Parameters:
T - the resulting type, the "Target"
S - the input type, the "Source"
All Superinterfaces:
Component<EncoderKey>, Keyed<EncoderKey>
All Known Subinterfaces:
ConformanceClassEncoder<T,S>, ObservationEncoder<S,T>, ProcedureEncoder<S,T>, SchemaAwareEncoder<T,S>, StreamingEncoder<T,S>
All Known Implementing Classes:
AbstractDelegatingEncoder, UVFEncoder

public interface Encoder<T,S> extends Component<EncoderKey>
Generic interface for Encoders.
Since:
1.0.0
  • Method Details

    • encode

      T encode(S objectToEncode) throws EncodingException
      Encodes the specified object.
      Parameters:
      objectToEncode - the object to encode
      Returns:
      the encoded object
      Throws:
      EncodingException - if an error occurs
    • encode

      T encode(S objectToEncode, EncodingContext additionalValues) throws EncodingException
      Encodes the specified object with the specified EncodingContext .
      Parameters:
      objectToEncode - the object to encode
      additionalValues - the helper values
      Returns:
      the encoded object
      Throws:
      EncodingException - if an error occurs
    • getSupportedTypes

      default Set<SupportedType> getSupportedTypes()
      Returns:
      the supported key types
    • getContentType

      MediaType getContentType()
      Returns:
      the content type of the encoded response.