public abstract class MapperMediaTypeCodec extends java.lang.Object implements MediaTypeCodec
MediaTypeCodec for JsonMapper based implementations.| Modifier and Type | Field and Description | 
|---|---|
| protected java.util.List<MediaType> | additionalTypes | 
| protected ApplicationConfiguration | applicationConfiguration | 
| protected CodecConfiguration | codecConfiguration | 
| protected MediaType | mediaType | 
| static java.lang.String | REGULAR_JSON_MEDIA_TYPE_CODEC_NAME | 
| Constructor and Description | 
|---|
| MapperMediaTypeCodec(BeanProvider<JsonMapper> mapperProvider,
                    ApplicationConfiguration applicationConfiguration,
                    CodecConfiguration codecConfiguration,
                    MediaType mediaType) | 
| MapperMediaTypeCodec(JsonMapper mapper,
                    ApplicationConfiguration applicationConfiguration,
                    CodecConfiguration codecConfiguration,
                    MediaType mediaType) | 
| Modifier and Type | Method and Description | 
|---|---|
| MapperMediaTypeCodec | cloneWithFeatures(JsonFeatures features)Create a copy of this codec with the given features. | 
| protected abstract MapperMediaTypeCodec | cloneWithMapper(JsonMapper mapper) | 
| MapperMediaTypeCodec | cloneWithViewClass(java.lang.Class<?> viewClass) | 
| <T> T | decode(Argument<T> type,
      byte[] bytes)Decode the given type from the given bytes. | 
| <T> T | decode(Argument<T> type,
      ByteBuffer<?> buffer)Decode the given type from the given buffer. | 
| <T> T | decode(Argument<T> type,
      java.io.InputStream inputStream)Decode the given type from the given  InputStream. | 
| <T> T | decode(Argument<T> type,
      JsonNode node)Decodes the given JSON node. | 
| <T> T | decode(Argument<T> type,
      java.lang.String data)Decode the given type from the given bytes. | 
| <T> byte[] | encode(Argument<T> type,
      T object)Encode the given type returning the object as a byte[]. | 
| <T,B> ByteBuffer<B> | encode(Argument<T> type,
      T object,
      ByteBufferFactory<?,B> allocator)Encode the given type returning the object as a  ByteBuffer. | 
| <T> void | encode(Argument<T> type,
      T object,
      java.io.OutputStream outputStream)Encode the given type to the given  OutputStream. | 
| <T> byte[] | encode(T object)Encode the given type returning the object as a byte[]. | 
| <T,B> ByteBuffer<B> | encode(T object,
      ByteBufferFactory<?,B> allocator)Encode the given type returning the object as a  ByteBuffer. | 
| <T> void | encode(T object,
      java.io.OutputStream outputStream)Encode the given type to the given  OutputStream. | 
| JsonMapper | getJsonMapper() | 
| java.util.Collection<MediaType> | getMediaTypes() | 
| boolean | supportsType(java.lang.Class<?> type)Whether the codec can decode the given type. | 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdecode, decode, decode, decodepublic static final java.lang.String REGULAR_JSON_MEDIA_TYPE_CODEC_NAME
protected final ApplicationConfiguration applicationConfiguration
protected final java.util.List<MediaType> additionalTypes
protected final CodecConfiguration codecConfiguration
protected final MediaType mediaType
public MapperMediaTypeCodec(BeanProvider<JsonMapper> mapperProvider, ApplicationConfiguration applicationConfiguration, CodecConfiguration codecConfiguration, MediaType mediaType)
mapperProvider - To read/write JSONapplicationConfiguration - The common application configurationscodecConfiguration - The configuration for the codecmediaType - Client request/response media typepublic MapperMediaTypeCodec(JsonMapper mapper, ApplicationConfiguration applicationConfiguration, CodecConfiguration codecConfiguration, MediaType mediaType)
mapper - To read/write JSONapplicationConfiguration - The common application configurationscodecConfiguration - The configuration for the codecmediaType - Client request/response media typepublic JsonMapper getJsonMapper()
public MapperMediaTypeCodec cloneWithFeatures(JsonFeatures features)
cloneWithMapper(io.micronaut.json.JsonMapper)
 instead.features - The features to apply.public final MapperMediaTypeCodec cloneWithViewClass(java.lang.Class<?> viewClass)
protected abstract MapperMediaTypeCodec cloneWithMapper(JsonMapper mapper)
public java.util.Collection<MediaType> getMediaTypes()
getMediaTypes in interface MediaTypeCodecpublic boolean supportsType(java.lang.Class<?> type)
MediaTypeCodecsupportsType in interface MediaTypeCodectype - The typepublic <T> T decode(Argument<T> type, java.io.InputStream inputStream) throws CodecException
MediaTypeCodecInputStream.decode in interface MediaTypeCodecT - The generic typetype - The typeinputStream - The input streamCodecException - When the result cannot be decodedpublic <T> T decode(Argument<T> type, JsonNode node) throws CodecException
T - The generic typetype - The typenode - The Json NodeCodecException - When object cannot be decodedpublic <T> T decode(Argument<T> type, ByteBuffer<?> buffer) throws CodecException
MediaTypeCodecByteBuffer instances
 should override this method.decode in interface MediaTypeCodecT - The decoded typetype - The typebuffer - the bufferCodecException - When the result cannot be decodedpublic <T> T decode(Argument<T> type, byte[] bytes) throws CodecException
MediaTypeCodecdecode in interface MediaTypeCodecT - The decoded typetype - The typebytes - The bytesCodecException - When the result cannot be decodedpublic <T> T decode(Argument<T> type, java.lang.String data) throws CodecException
MediaTypeCodecdecode in interface MediaTypeCodecT - The decoded typetype - The typedata - The data as a stringCodecException - When the result cannot be decodedpublic <T> void encode(T object,
                       java.io.OutputStream outputStream)
                throws CodecException
MediaTypeCodecOutputStream.encode in interface MediaTypeCodecT - The generic typeobject - The object to encodeoutputStream - The output streamCodecException - When the result cannot be encodedpublic <T> void encode(Argument<T> type, T object, java.io.OutputStream outputStream) throws CodecException
MediaTypeCodecOutputStream.encode in interface MediaTypeCodecT - The generic typetype - The type including any generics and/or metadata.object - The object to encodeoutputStream - The output streamCodecException - When the result cannot be encodedpublic <T> byte[] encode(T object)
                  throws CodecException
MediaTypeCodecencode in interface MediaTypeCodecT - The generic typeobject - The object to encodeCodecException - When the result cannot be encodedpublic <T> byte[] encode(Argument<T> type, T object) throws CodecException
MediaTypeCodecencode in interface MediaTypeCodecT - The generic typetype - The type including any generics and/or metadataobject - The object to encodeCodecException - When the result cannot be encodedpublic <T,B> ByteBuffer<B> encode(T object, ByteBufferFactory<?,B> allocator) throws CodecException
MediaTypeCodecByteBuffer.encode in interface MediaTypeCodecT - The generic typeB - The buffer typeobject - The object to encodeallocator - The allocatorCodecException - When the result cannot be encodedpublic <T,B> ByteBuffer<B> encode(Argument<T> type, T object, ByteBufferFactory<?,B> allocator) throws CodecException
MediaTypeCodecByteBuffer.encode in interface MediaTypeCodecT - The generic typeB - The buffer typetype - The type including any generics and/or metadataobject - The object to encodeallocator - The allocatorCodecException - When the result cannot be encoded