Package io.micronaut.jackson
Class ObjectMapperFactory
java.lang.Object
io.micronaut.jackson.ObjectMapperFactory
Factory bean for creating the Jackson
ObjectMapper
.- Since:
- 1.0
- Author:
- Graeme Rocher
-
Field Summary
Modifier and TypeFieldDescriptionprotected BeanContext
protected com.fasterxml.jackson.databind.deser.BeanDeserializerModifier[]
protected com.fasterxml.jackson.databind.ser.BeanSerializerModifier[]
protected ConversionService
protected com.fasterxml.jackson.databind.JsonDeserializer[]
protected com.fasterxml.jackson.databind.Module[]
protected com.fasterxml.jackson.databind.KeyDeserializer[]
static final String
Name for Micronaut module.protected com.fasterxml.jackson.databind.JsonSerializer[]
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncom.fasterxml.jackson.core.JsonFactory
jsonFactory
(JacksonConfiguration jacksonConfiguration) Builds default FactoryJsonFactory
using properties fromJacksonConfiguration
.com.fasterxml.jackson.databind.ObjectMapper
objectMapper
(@Nullable JacksonConfiguration jacksonConfiguration, @Nullable com.fasterxml.jackson.core.JsonFactory jsonFactory) Builds the core JacksonObjectMapper
from the optional configuration andJsonFactory
.void
setDeserializers
(com.fasterxml.jackson.databind.JsonDeserializer... deserializers) Set additional deserializers.void
setSerializers
(com.fasterxml.jackson.databind.JsonSerializer... serializers) Set additional serializers.
-
Field Details
-
MICRONAUT_MODULE
Name for Micronaut module.- See Also:
-
conversionService
-
beanContext
-
jacksonModules
-
serializers
-
deserializers
-
beanSerializerModifiers
@Inject protected com.fasterxml.jackson.databind.ser.BeanSerializerModifier[] beanSerializerModifiers -
beanDeserializerModifiers
@Inject protected com.fasterxml.jackson.databind.deser.BeanDeserializerModifier[] beanDeserializerModifiers -
keyDeserializers
-
-
Constructor Details
-
ObjectMapperFactory
public ObjectMapperFactory()
-
-
Method Details
-
jsonFactory
@Requires(beans=JacksonConfiguration.class) @Singleton public com.fasterxml.jackson.core.JsonFactory jsonFactory(JacksonConfiguration jacksonConfiguration) Builds default FactoryJsonFactory
using properties fromJacksonConfiguration
.- Parameters:
jacksonConfiguration
- The configuration- Returns:
- The
JsonFactory
-
setSerializers
public void setSerializers(com.fasterxml.jackson.databind.JsonSerializer... serializers) Set additional serializers.- Parameters:
serializers
- The serializers- Since:
- 4.0
-
setDeserializers
public void setDeserializers(com.fasterxml.jackson.databind.JsonDeserializer... deserializers) Set additional deserializers.- Parameters:
deserializers
- The deserializers- Since:
- 4.0
-
objectMapper
@Singleton @Primary @Named("json") public com.fasterxml.jackson.databind.ObjectMapper objectMapper(@Nullable @Nullable JacksonConfiguration jacksonConfiguration, @Nullable @Nullable com.fasterxml.jackson.core.JsonFactory jsonFactory) Builds the core JacksonObjectMapper
from the optional configuration andJsonFactory
.- Parameters:
jacksonConfiguration
- The configurationjsonFactory
- The JSON factory- Returns:
- The
ObjectMapper
-