Class JsonByteBufMediaTypeConverter

java.lang.Object
io.inverno.mod.boot.converter.JsonByteBufMediaTypeConverter
All Implemented Interfaces:
Converter<ByteBuf,Object>, Decoder<ByteBuf,Object>, Encoder<Object,ByteBuf>, MediaTypeConverter<ByteBuf>, ReactiveConverter<ByteBuf,Object>, ReactiveDecoder<ByteBuf,Object>, ReactiveEncoder<Object,ByteBuf>

public class JsonByteBufMediaTypeConverter extends Object implements MediaTypeConverter<ByteBuf>

ByteBuf application/json media type converter.

Since:
1.0
Author:
Jeremy Kuhn
See Also:
  • Constructor Details

    • JsonByteBufMediaTypeConverter

      public JsonByteBufMediaTypeConverter(ReactiveConverter<ByteBuf,Object> jsonByteBufConverter)

      Create an application/json media type converter.

      Parameters:
      jsonByteBufConverter - the underlying JSON ByteBuf converter
  • Method Details

    • canConvert

      public boolean canConvert(String mediaType)
      Description copied from interface: MediaTypeConverter

      Determines whether the converter can convert the specified media type.

      Specified by:
      canConvert in interface MediaTypeConverter<ByteBuf>
      Parameters:
      mediaType - a media type
      Returns:
      true if the converter can convert the media type, false otherwise
    • encodeMany

      public <T> Publisher<ByteBuf> encodeMany(Flux<T> value)
      Description copied from interface: ReactiveEncoder

      Encodes a flux stream of values to a stream of values.

      Specified by:
      encodeMany in interface ReactiveEncoder<Object,ByteBuf>
      Type Parameters:
      T - the type of the decoded object
      Parameters:
      value - the flux stream of values to encode
      Returns:
      a stream of encoded values
    • encodeMany

      public <T> Publisher<ByteBuf> encodeMany(Flux<T> value, Class<T> type)
      Description copied from interface: ReactiveEncoder

      Encodes a flux stream of values whose type is represented by the specified class to a stream of values.

      Specified by:
      encodeMany in interface ReactiveEncoder<Object,ByteBuf>
      Type Parameters:
      T - the type of the decoded object
      Parameters:
      value - the flux stream of values to encode
      type - the class of the decoded object
      Returns:
      a stream of encoded values
    • encodeMany

      public <T> Publisher<ByteBuf> encodeMany(Flux<T> value, Type type)
      Description copied from interface: ReactiveEncoder

      Encodes a flux stream of values whose type is the specified type to a stream of values.

      Specified by:
      encodeMany in interface ReactiveEncoder<Object,ByteBuf>
      Type Parameters:
      T - the type of the decoded object
      Parameters:
      value - the flux stream of values to encode
      type - the type of the decoded object
      Returns:
      a stream of encoded values
    • decodeOne

      public <T> Mono<T> decodeOne(Publisher<ByteBuf> value, Class<T> type)
      Description copied from interface: ReactiveDecoder

      Decodes the specified stream of values whose type is represented by the specified class into a mono stream of values.

      Specified by:
      decodeOne in interface ReactiveDecoder<ByteBuf,Object>
      Type Parameters:
      T - the type of the decoded object
      Parameters:
      value - the stream of values to decode
      type - the class of the decoded object
      Returns:
      a mono emitting the decoded value
    • decodeOne

      public <T> Mono<T> decodeOne(Publisher<ByteBuf> value, Type type)
      Description copied from interface: ReactiveDecoder

      Decodes the specified stream of values whose type is the specified type into a mono stream of value.

      Specified by:
      decodeOne in interface ReactiveDecoder<ByteBuf,Object>
      Type Parameters:
      T - the type of the decoded object
      Parameters:
      value - the stream of values to decode
      type - the type of the decoded object
      Returns:
      a mono emitting the decoded value
    • decodeMany

      public <T> Flux<T> decodeMany(Publisher<ByteBuf> value, Class<T> type)
      Description copied from interface: ReactiveDecoder

      Decodes the specified stream of values whose type is represented by the specified class into a flux stream of values.

      Specified by:
      decodeMany in interface ReactiveDecoder<ByteBuf,Object>
      Type Parameters:
      T - the type of the decoded object
      Parameters:
      value - the stream of values to decode
      type - the class of the decoded object
      Returns:
      a flux emitting the decoded values
    • decodeMany

      public <T> Flux<T> decodeMany(Publisher<ByteBuf> value, Type type)
      Description copied from interface: ReactiveDecoder

      Decodes the specified stream of values whose type is the specified type into a flux stream of values.

      Specified by:
      decodeMany in interface ReactiveDecoder<ByteBuf,Object>
      Type Parameters:
      T - the type of the decoded object
      Parameters:
      value - the stream of values to decode
      type - the type of the decoded object
      Returns:
      a flux emitting the decoded values
    • decode

      public <T> T decode(ByteBuf value, Class<T> type)
      Description copied from interface: Decoder

      Decodes the specified value to an object whose type is represented by the specified class.

      Specified by:
      decode in interface Decoder<ByteBuf,Object>
      Type Parameters:
      T - the type of the decoded object
      Parameters:
      value - the object to decode
      type - the class of the decoded object
      Returns:
      a decoded object
    • decode

      public <T> T decode(ByteBuf value, Type type) throws ConverterException
      Description copied from interface: Decoder

      Decodes the specified value to an object of the specified type.

      Specified by:
      decode in interface Decoder<ByteBuf,Object>
      Type Parameters:
      T - the type of the decoded object
      Parameters:
      value - the object to decode
      type - the type of the decoded object
      Returns:
      a decoded object
      Throws:
      ConverterException - if there was an error decoding the value
    • encodeOne

      public <T> Publisher<ByteBuf> encodeOne(Mono<T> value)
      Description copied from interface: ReactiveEncoder

      Encodes a mono stream of values to a stream of values.

      Specified by:
      encodeOne in interface ReactiveEncoder<Object,ByteBuf>
      Type Parameters:
      T - the type of the decoded object
      Parameters:
      value - the mono stream of values to encode
      Returns:
      a stream of encoded values
    • encodeOne

      public <T> Publisher<ByteBuf> encodeOne(Mono<T> value, Class<T> type)
      Description copied from interface: ReactiveEncoder

      Encodes a mono stream of values whose type is represented by the specified class to a stream of values.

      Specified by:
      encodeOne in interface ReactiveEncoder<Object,ByteBuf>
      Type Parameters:
      T - the type of the decoded object
      Parameters:
      value - the mono stream of values to encode
      type - the class of the decoded object
      Returns:
      a stream of encoded values
    • encodeOne

      public <T> Publisher<ByteBuf> encodeOne(Mono<T> value, Type type)
      Description copied from interface: ReactiveEncoder

      Encodes a mono stream of values whose type is the specified type to a stream of values.

      Specified by:
      encodeOne in interface ReactiveEncoder<Object,ByteBuf>
      Type Parameters:
      T - the type of the decoded object
      Parameters:
      value - the mono stream of values to encode
      type - the type of the decoded object
      Returns:
      a stream of encoded values
    • encode

      public <T> ByteBuf encode(T value)
      Description copied from interface: Encoder

      Encodes the specified value to the encoded type.

      Specified by:
      encode in interface Encoder<Object,ByteBuf>
      Type Parameters:
      T - the type of the decoded object
      Parameters:
      value - the object to encode
      Returns:
      an encoded object
    • encode

      public <T> ByteBuf encode(T value, Class<T> type) throws ConverterException
      Description copied from interface: Encoder

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

      Specified by:
      encode in interface Encoder<Object,ByteBuf>
      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

      public <T> ByteBuf encode(T value, Type type) throws ConverterException
      Description copied from interface: Encoder

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

      Specified by:
      encode in interface Encoder<Object,ByteBuf>
      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