Package io.micronaut.jackson.codec
Class JacksonMediaTypeCodec
java.lang.Object
io.micronaut.json.codec.MapperMediaTypeCodec
io.micronaut.jackson.codec.JacksonMediaTypeCodec
- All Implemented Interfaces:
MediaTypeCodec
- Direct Known Subclasses:
JsonMediaTypeCodec
A
MediaTypeCodec for JSON and Jackson.
Note: will be replaced by MapperMediaTypeCodec in the future, but that class is currently experimental.- Since:
- 1.0.0
- Author:
- Graeme Rocher
-
Field Summary
FieldsFields inherited from class io.micronaut.json.codec.MapperMediaTypeCodec
additionalTypes, applicationConfiguration, codecConfiguration, mediaType -
Constructor Summary
ConstructorsConstructorDescriptionJacksonMediaTypeCodec(com.fasterxml.jackson.databind.ObjectMapper objectMapper, ApplicationConfiguration applicationConfiguration, CodecConfiguration codecConfiguration, MediaType mediaType) JacksonMediaTypeCodec(BeanProvider<com.fasterxml.jackson.databind.ObjectMapper> objectMapperProvider, ApplicationConfiguration applicationConfiguration, CodecConfiguration codecConfiguration, MediaType mediaType) -
Method Summary
Modifier and TypeMethodDescriptionabstract JacksonMediaTypeCodeccloneWithFeatures(JacksonFeatures jacksonFeatures) Create a new codec with the provided features.cloneWithFeatures(JsonFeatures features) Create a copy of this codec with the given features.protected MapperMediaTypeCodeccloneWithMapper(JsonMapper mapper) <T> TDecodes the given JSON node.com.fasterxml.jackson.databind.ObjectMapperMethods inherited from class io.micronaut.json.codec.MapperMediaTypeCodec
cloneWithViewClass, decode, decode, decode, decode, decode, encode, encode, encode, encode, encode, encode, getJsonMapper, getMediaTypes, supportsTypeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.micronaut.http.codec.MediaTypeCodec
decode, decode, decode, decode
-
Field Details
-
REGULAR_JSON_MEDIA_TYPE_CODEC_NAME
- See Also:
-
-
Constructor Details
-
JacksonMediaTypeCodec
public JacksonMediaTypeCodec(BeanProvider<com.fasterxml.jackson.databind.ObjectMapper> objectMapperProvider, ApplicationConfiguration applicationConfiguration, CodecConfiguration codecConfiguration, MediaType mediaType) -
JacksonMediaTypeCodec
public JacksonMediaTypeCodec(com.fasterxml.jackson.databind.ObjectMapper objectMapper, ApplicationConfiguration applicationConfiguration, CodecConfiguration codecConfiguration, MediaType mediaType)
-
-
Method Details
-
getObjectMapper
public com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()- Returns:
- The object mapper
-
cloneWithFeatures
Description copied from class:MapperMediaTypeCodecCreate a copy of this codec with the given features. Should not be extended, extendMapperMediaTypeCodec.cloneWithMapper(io.micronaut.json.JsonMapper)instead.- Overrides:
cloneWithFeaturesin classMapperMediaTypeCodec- Parameters:
features- The features to apply.- Returns:
- A new codec with the features applied, leaving this codec unchanged.
-
cloneWithFeatures
Create a new codec with the provided features.- Parameters:
jacksonFeatures- The jackson features- Returns:
- The new codec
-
cloneWithMapper
- Specified by:
cloneWithMapperin classMapperMediaTypeCodec
-
decode
public <T> T decode(Argument<T> type, com.fasterxml.jackson.databind.JsonNode node) throws CodecException 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
-