Class MapperMediaTypeCodec

java.lang.Object
io.micronaut.json.codec.MapperMediaTypeCodec
All Implemented Interfaces:
MediaTypeCodec
Direct Known Subclasses:
JacksonMediaTypeCodec, JsonMediaTypeCodec

@Deprecated(since="4.7") public abstract class MapperMediaTypeCodec extends Object implements MediaTypeCodec
Deprecated.
Replaced with message body writers / readers API
A MediaTypeCodec for JsonMapper based implementations.
Since:
1.3.0
Author:
Graeme Rocher, svishnyakov
  • Field Details

    • REGULAR_JSON_MEDIA_TYPE_CODEC_NAME

      public static final String REGULAR_JSON_MEDIA_TYPE_CODEC_NAME
      Deprecated.
      See Also:
    • applicationConfiguration

      protected final ApplicationConfiguration applicationConfiguration
      Deprecated.
    • additionalTypes

      protected final List<MediaType> additionalTypes
      Deprecated.
    • codecConfiguration

      protected final CodecConfiguration codecConfiguration
      Deprecated.
    • mediaType

      protected final MediaType mediaType
      Deprecated.
  • Constructor Details

    • MapperMediaTypeCodec

      public MapperMediaTypeCodec(BeanProvider<JsonMapper> mapperProvider, ApplicationConfiguration applicationConfiguration, CodecConfiguration codecConfiguration, MediaType mediaType)
      Deprecated.
      Parameters:
      mapperProvider - To read/write JSON
      applicationConfiguration - The common application configurations
      codecConfiguration - The configuration for the codec
      mediaType - Client request/response media type
    • MapperMediaTypeCodec

      public MapperMediaTypeCodec(BeanProvider<JsonMapper> mapperProvider, ApplicationConfiguration applicationConfiguration, CodecConfiguration codecConfiguration, MediaType mediaType, @Nullable @Nullable List<MediaType> additionalTypes)
      Deprecated.
      Parameters:
      mapperProvider - To read/write JSON
      applicationConfiguration - The common application configurations
      codecConfiguration - The configuration for the codec
      mediaType - Client request/response media type
      additionalTypes - Additional Media Types
    • MapperMediaTypeCodec

      public MapperMediaTypeCodec(JsonMapper mapper, ApplicationConfiguration applicationConfiguration, CodecConfiguration codecConfiguration, MediaType mediaType)
      Deprecated.
      Parameters:
      mapper - To read/write JSON
      applicationConfiguration - The common application configurations
      codecConfiguration - The configuration for the codec
      mediaType - Client request/response media type
  • Method Details

    • getJsonMapper

      public JsonMapper getJsonMapper()
      Deprecated.
      Returns:
      The object mapper
    • cloneWithFeatures

      public MapperMediaTypeCodec cloneWithFeatures(JsonFeatures features)
      Deprecated.
      Create a copy of this codec with the given features. Should not be extended, extend cloneWithMapper(io.micronaut.json.JsonMapper) instead.
      Parameters:
      features - The features to apply.
      Returns:
      A new codec with the features applied, leaving this codec unchanged.
    • cloneWithViewClass

      public final MapperMediaTypeCodec cloneWithViewClass(Class<?> viewClass)
      Deprecated.
    • cloneWithMapper

      protected abstract MapperMediaTypeCodec cloneWithMapper(JsonMapper mapper)
      Deprecated.
    • getMediaTypes

      public Collection<MediaType> getMediaTypes()
      Deprecated.
      Specified by:
      getMediaTypes in interface MediaTypeCodec
      Returns:
      The media type of the codec
    • supportsType

      public boolean supportsType(Class<?> type)
      Deprecated.
      Description copied from interface: MediaTypeCodec
      Whether the codec can decode the given type.
      Specified by:
      supportsType in interface MediaTypeCodec
      Parameters:
      type - The type
      Returns:
      True if it can
    • decode

      public <T> T decode(Argument<T> type, InputStream inputStream) throws CodecException
      Deprecated.
      Description copied from interface: MediaTypeCodec
      Decode the given type from the given InputStream.
      Specified by:
      decode in interface MediaTypeCodec
      Type Parameters:
      T - The generic type
      Parameters:
      type - The type
      inputStream - The input stream
      Returns:
      The decoded result
      Throws:
      CodecException - When the result cannot be decoded
    • decode

      public <T> T decode(Argument<T> type, JsonNode node) throws CodecException
      Deprecated.
      Decodes the given JSON node.
      Type Parameters:
      T - The generic type
      Parameters:
      type - The type
      node - The Json Node
      Returns:
      The decoded object
      Throws:
      CodecException - When object cannot be decoded
    • decode

      public <T> T decode(Argument<T> type, ByteBuffer<?> buffer) throws CodecException
      Deprecated.
      Description copied from interface: MediaTypeCodec
      Decode the given type from the given buffer. Implementations optimized to handle ByteBuffer instances should override this method.
      Specified by:
      decode in interface MediaTypeCodec
      Type Parameters:
      T - The decoded type
      Parameters:
      type - The type
      buffer - the buffer
      Returns:
      The decoded result
      Throws:
      CodecException - When the result cannot be decoded
    • decode

      public <T> T decode(Argument<T> type, byte[] bytes) throws CodecException
      Deprecated.
      Description copied from interface: MediaTypeCodec
      Decode the given type from the given bytes.
      Specified by:
      decode in interface MediaTypeCodec
      Type Parameters:
      T - The decoded type
      Parameters:
      type - The type
      bytes - The bytes
      Returns:
      The decoded result
      Throws:
      CodecException - When the result cannot be decoded
    • decode

      public <T> T decode(Argument<T> type, String data) throws CodecException
      Deprecated.
      Description copied from interface: MediaTypeCodec
      Decode the given type from the given bytes.
      Specified by:
      decode in interface MediaTypeCodec
      Type Parameters:
      T - The decoded type
      Parameters:
      type - The type
      data - The data as a string
      Returns:
      The decoded result
      Throws:
      CodecException - When the result cannot be decoded
    • encode

      public <T> void encode(T object, OutputStream outputStream) throws CodecException
      Deprecated.
      Description copied from interface: MediaTypeCodec
      Encode the given type to the given OutputStream.
      Specified by:
      encode in interface MediaTypeCodec
      Type Parameters:
      T - The generic type
      Parameters:
      object - The object to encode
      outputStream - The output stream
      Throws:
      CodecException - When the result cannot be encoded
    • encode

      public <T> void encode(@NonNull @NonNull Argument<T> type, @NonNull T object, @NonNull @NonNull OutputStream outputStream) throws CodecException
      Deprecated.
      Description copied from interface: MediaTypeCodec
      Encode the given type to the given OutputStream.
      Specified by:
      encode in interface MediaTypeCodec
      Type Parameters:
      T - The generic type
      Parameters:
      type - The type including any generics and/or metadata.
      object - The object to encode
      outputStream - The output stream
      Throws:
      CodecException - When the result cannot be encoded
    • encode

      public <T> byte[] encode(T object) throws CodecException
      Deprecated.
      Description copied from interface: MediaTypeCodec
      Encode the given type returning the object as a byte[].
      Specified by:
      encode in interface MediaTypeCodec
      Type Parameters:
      T - The generic type
      Parameters:
      object - The object to encode
      Returns:
      The decoded result
      Throws:
      CodecException - When the result cannot be encoded
    • encode

      public <T> byte[] encode(@NonNull @NonNull Argument<T> type, T object) throws CodecException
      Deprecated.
      Description copied from interface: MediaTypeCodec
      Encode the given type returning the object as a byte[].
      Specified by:
      encode in interface MediaTypeCodec
      Type Parameters:
      T - The generic type
      Parameters:
      type - The type including any generics and/or metadata
      object - The object to encode
      Returns:
      The decoded result
      Throws:
      CodecException - When the result cannot be encoded
    • encode

      public <T, B> ByteBuffer<B> encode(T object, ByteBufferFactory<?,B> allocator) throws CodecException
      Deprecated.
      Description copied from interface: MediaTypeCodec
      Encode the given type returning the object as a ByteBuffer.
      Specified by:
      encode in interface MediaTypeCodec
      Type Parameters:
      T - The generic type
      B - The buffer type
      Parameters:
      object - The object to encode
      allocator - The allocator
      Returns:
      The decoded result
      Throws:
      CodecException - When the result cannot be encoded
    • encode

      @NonNull public <T, B> @NonNull ByteBuffer<B> encode(@NonNull @NonNull Argument<T> type, T object, @NonNull @NonNull ByteBufferFactory<?,B> allocator) throws CodecException
      Deprecated.
      Description copied from interface: MediaTypeCodec
      Encode the given type returning the object as a ByteBuffer.
      Specified by:
      encode in interface MediaTypeCodec
      Type Parameters:
      T - The generic type
      B - The buffer type
      Parameters:
      type - The type including any generics and/or metadata
      object - The object to encode
      allocator - The allocator
      Returns:
      The decoded result
      Throws:
      CodecException - When the result cannot be encoded