Package io.micronaut.json.codec
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 Summary
Modifier and TypeFieldDescriptionDeprecated.protected final ApplicationConfiguration
Deprecated.protected final CodecConfiguration
Deprecated.protected final MediaType
Deprecated.static final String
Deprecated. -
Constructor Summary
ConstructorDescriptionMapperMediaTypeCodec
(BeanProvider<JsonMapper> mapperProvider, ApplicationConfiguration applicationConfiguration, CodecConfiguration codecConfiguration, MediaType mediaType) Deprecated.MapperMediaTypeCodec
(BeanProvider<JsonMapper> mapperProvider, ApplicationConfiguration applicationConfiguration, CodecConfiguration codecConfiguration, MediaType mediaType, @Nullable List<MediaType> additionalTypes) Deprecated.MapperMediaTypeCodec
(JsonMapper mapper, ApplicationConfiguration applicationConfiguration, CodecConfiguration codecConfiguration, MediaType mediaType) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptioncloneWithFeatures
(JsonFeatures features) Deprecated.Create a copy of this codec with the given features.protected abstract MapperMediaTypeCodec
cloneWithMapper
(JsonMapper mapper) Deprecated.final MapperMediaTypeCodec
cloneWithViewClass
(Class<?> viewClass) Deprecated.<T> T
Deprecated.Decode the given type from the given bytes.<T> T
decode
(Argument<T> type, ByteBuffer<?> buffer) Deprecated.Decode the given type from the given buffer.<T> T
Deprecated.Decodes the given JSON node.<T> T
decode
(Argument<T> type, InputStream inputStream) Deprecated.Decode the given type from the givenInputStream
.<T> T
Deprecated.Decode the given type from the given bytes.<T> byte[]
Deprecated.Encode the given type returning the object as a byte[].<T,
B> @NonNull ByteBuffer<B> encode
(@NonNull Argument<T> type, T object, @NonNull ByteBufferFactory<?, B> allocator) Deprecated.Encode the given type returning the object as aByteBuffer
.<T> void
encode
(@NonNull Argument<T> type, T object, @NonNull OutputStream outputStream) Deprecated.Encode the given type to the givenOutputStream
.<T> byte[]
encode
(T object) Deprecated.Encode the given type returning the object as a byte[].<T,
B> ByteBuffer<B> encode
(T object, ByteBufferFactory<?, B> allocator) Deprecated.Encode the given type returning the object as aByteBuffer
.<T> void
encode
(T object, OutputStream outputStream) Deprecated.Encode the given type to the givenOutputStream
.Deprecated.Deprecated.boolean
supportsType
(Class<?> type) Deprecated.Whether the codec can decode the given type.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.http.codec.MediaTypeCodec
decode, decode, decode, decode
-
Field Details
-
REGULAR_JSON_MEDIA_TYPE_CODEC_NAME
Deprecated.- See Also:
-
applicationConfiguration
Deprecated. -
additionalTypes
Deprecated. -
codecConfiguration
Deprecated. -
mediaType
Deprecated.
-
-
Constructor Details
-
MapperMediaTypeCodec
public MapperMediaTypeCodec(BeanProvider<JsonMapper> mapperProvider, ApplicationConfiguration applicationConfiguration, CodecConfiguration codecConfiguration, MediaType mediaType) Deprecated.- Parameters:
mapperProvider
- To read/write JSONapplicationConfiguration
- The common application configurationscodecConfiguration
- The configuration for the codecmediaType
- 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 JSONapplicationConfiguration
- The common application configurationscodecConfiguration
- The configuration for the codecmediaType
- Client request/response media typeadditionalTypes
- Additional Media Types
-
MapperMediaTypeCodec
public MapperMediaTypeCodec(JsonMapper mapper, ApplicationConfiguration applicationConfiguration, CodecConfiguration codecConfiguration, MediaType mediaType) Deprecated.- Parameters:
mapper
- To read/write JSONapplicationConfiguration
- The common application configurationscodecConfiguration
- The configuration for the codecmediaType
- Client request/response media type
-
-
Method Details
-
getJsonMapper
Deprecated.- Returns:
- The object mapper
-
cloneWithFeatures
Deprecated.Create a copy of this codec with the given features. Should not be extended, extendcloneWithMapper(io.micronaut.json.JsonMapper)
instead.- Parameters:
features
- The features to apply.- Returns:
- A new codec with the features applied, leaving this codec unchanged.
-
cloneWithViewClass
Deprecated. -
cloneWithMapper
Deprecated. -
getMediaTypes
Deprecated.- Specified by:
getMediaTypes
in interfaceMediaTypeCodec
- Returns:
- The media type of the codec
-
supportsType
Deprecated.Description copied from interface:MediaTypeCodec
Whether the codec can decode the given type.- Specified by:
supportsType
in interfaceMediaTypeCodec
- Parameters:
type
- The type- Returns:
- True if it can
-
decode
Deprecated.Description copied from interface:MediaTypeCodec
Decode the given type from the givenInputStream
.- Specified by:
decode
in interfaceMediaTypeCodec
- Type Parameters:
T
- The generic type- Parameters:
type
- The typeinputStream
- The input stream- Returns:
- The decoded result
- Throws:
CodecException
- When the result cannot be decoded
-
decode
Deprecated.Decodes the given JSON node.- Type Parameters:
T
- The generic type- Parameters:
type
- The typenode
- The Json Node- Returns:
- The decoded object
- Throws:
CodecException
- When object cannot be decoded
-
decode
Deprecated.Description copied from interface:MediaTypeCodec
Decode the given type from the given buffer. Implementations optimized to handleByteBuffer
instances should override this method.- Specified by:
decode
in interfaceMediaTypeCodec
- Type Parameters:
T
- The decoded type- Parameters:
type
- The typebuffer
- the buffer- Returns:
- The decoded result
- Throws:
CodecException
- When the result cannot be decoded
-
decode
Deprecated.Description copied from interface:MediaTypeCodec
Decode the given type from the given bytes.- Specified by:
decode
in interfaceMediaTypeCodec
- Type Parameters:
T
- The decoded type- Parameters:
type
- The typebytes
- The bytes- Returns:
- The decoded result
- Throws:
CodecException
- When the result cannot be decoded
-
decode
Deprecated.Description copied from interface:MediaTypeCodec
Decode the given type from the given bytes.- Specified by:
decode
in interfaceMediaTypeCodec
- Type Parameters:
T
- The decoded type- Parameters:
type
- The typedata
- The data as a string- Returns:
- The decoded result
- Throws:
CodecException
- When the result cannot be decoded
-
encode
Deprecated.Description copied from interface:MediaTypeCodec
Encode the given type to the givenOutputStream
.- Specified by:
encode
in interfaceMediaTypeCodec
- Type Parameters:
T
- The generic type- Parameters:
object
- The object to encodeoutputStream
- 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 givenOutputStream
.- Specified by:
encode
in interfaceMediaTypeCodec
- Type Parameters:
T
- The generic type- Parameters:
type
- The type including any generics and/or metadata.object
- The object to encodeoutputStream
- The output stream- Throws:
CodecException
- When the result cannot be encoded
-
encode
Deprecated.Description copied from interface:MediaTypeCodec
Encode the given type returning the object as a byte[].- Specified by:
encode
in interfaceMediaTypeCodec
- 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
Deprecated.Description copied from interface:MediaTypeCodec
Encode the given type returning the object as a byte[].- Specified by:
encode
in interfaceMediaTypeCodec
- Type Parameters:
T
- The generic type- Parameters:
type
- The type including any generics and/or metadataobject
- 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 CodecExceptionDeprecated.Description copied from interface:MediaTypeCodec
Encode the given type returning the object as aByteBuffer
.- Specified by:
encode
in interfaceMediaTypeCodec
- Type Parameters:
T
- The generic typeB
- The buffer type- Parameters:
object
- The object to encodeallocator
- 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 CodecExceptionDeprecated.Description copied from interface:MediaTypeCodec
Encode the given type returning the object as aByteBuffer
.- Specified by:
encode
in interfaceMediaTypeCodec
- Type Parameters:
T
- The generic typeB
- The buffer type- Parameters:
type
- The type including any generics and/or metadataobject
- The object to encodeallocator
- The allocator- Returns:
- The decoded result
- Throws:
CodecException
- When the result cannot be encoded
-