Class JacksonJsonMapper
java.lang.Object
io.micronaut.serde.jackson.JacksonJsonMapper
- All Implemented Interfaces:
io.micronaut.json.JsonMapper, JacksonObjectMapper, ObjectMapper
@Internal
@Singleton
@Primary
public final class JacksonJsonMapper
extends Object
implements JacksonObjectMapper
Implementation of the
JsonMapper interface for Jackson.-
Nested Class Summary
Nested classes/interfaces inherited from interface ObjectMapper
ObjectMapper.CloseableObjectMapper -
Constructor Summary
ConstructorsConstructorDescriptionJacksonJsonMapper(SerdeRegistry registry, SerdeConfiguration serdeConfiguration, SerdeJacksonConfiguration jacksonConfiguration) -
Method Summary
Modifier and TypeMethodDescriptioncloneWithConfiguration(@Nullable SerdeConfiguration configuration, @Nullable SerializationConfiguration serializationConfiguration, @Nullable DeserializationConfiguration deserializationConfiguration) Optional feature.cloneWithConfiguration(@Nullable SerdeConfiguration configuration, @Nullable SerializationConfiguration serializationConfiguration, @Nullable DeserializationConfiguration deserializationConfiguration, @Nullable SerdeIntrospections introspections) Optional feature.cloneWithConfiguration(SerdeJacksonConfiguration jacksonConfiguration) Create a newJacksonObjectMapperwith the given configuration.io.micronaut.json.JsonMappercloneWithViewClass(Class<?> viewClass) org.reactivestreams.Processor<byte[], io.micronaut.json.tree.JsonNode> createReactiveParser(Consumer<org.reactivestreams.Processor<byte[], io.micronaut.json.tree.JsonNode>> onSubscribe, boolean streamArray) io.micronaut.json.JsonMappercreateSpecific(io.micronaut.core.type.Argument<?> type) Returns theSerdeRegistryused by this object mapper, if possible.io.micronaut.json.JsonStreamConfig<T> @Nullable TreadValue(byte[] byteArray, io.micronaut.core.type.Argument<T> type) <T> @Nullable TreadValue(io.micronaut.core.io.buffer.ByteBuffer<?> byteBuffer, io.micronaut.core.type.Argument<T> type) <T> @Nullable TreadValue(InputStream inputStream, io.micronaut.core.type.Argument<T> type) <T> @Nullable TreadValueFromTree(io.micronaut.json.tree.JsonNode tree, io.micronaut.core.type.Argument<T> type) <T> TupdateValue(T valueToUpdate, io.micronaut.core.type.Argument<T> type, byte[] byteArray) Update an existing mutable value from JSON read from the supplied byte array.<T> TupdateValue(T valueToUpdate, io.micronaut.core.type.Argument<T> type, io.micronaut.core.io.buffer.ByteBuffer<?> byteBuffer) Update an existing mutable value from JSON read from the supplied byte buffer.<T> TupdateValue(T valueToUpdate, io.micronaut.core.type.Argument<T> type, InputStream inputStream) Update an existing mutable value from JSON read from the supplied input stream.<T> TupdateValue(T valueToUpdate, io.micronaut.core.type.Argument<T> type, @Nullable Object overrides) Update an existing mutable value from the supplied override value.<T> TupdateValue(T valueToUpdate, @Nullable Object overrides) Update an existing mutable value from the supplied override value.voidupdateValueFromTree(Object value, io.micronaut.json.tree.JsonNode tree) <T> voidwriteValue(OutputStream outputStream, io.micronaut.core.type.Argument<T> type, @Nullable T object) voidwriteValue(OutputStream outputStream, @Nullable Object object) <T> byte[]writeValueAsBytes(io.micronaut.core.type.Argument<T> type, @Nullable T object) byte[]writeValueAsBytes(@Nullable Object object) <T> io.micronaut.json.tree.JsonNodewriteValueToTree(io.micronaut.core.type.Argument<T> type, @Nullable T value) io.micronaut.json.tree.JsonNodewriteValueToTree(@Nullable Object value) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.micronaut.json.JsonMapper
detectFeatures, readValue, readValue, readValue, readValue, readValue, readValueFromTree, writeValueAsString, writeValueAsString, writeValueAsStringMethods inherited from interface ObjectMapper
cloneWithFeatures
-
Constructor Details
-
JacksonJsonMapper
@Inject @Internal public JacksonJsonMapper(SerdeRegistry registry, SerdeConfiguration serdeConfiguration, SerdeJacksonConfiguration jacksonConfiguration)
-
-
Method Details
-
getSerdeRegistry
Description copied from interface:ObjectMapperReturns theSerdeRegistryused by this object mapper, if possible.- Specified by:
getSerdeRegistryin interfaceObjectMapper- Returns:
- The serde registry
-
createSpecific
public io.micronaut.json.JsonMapper createSpecific(io.micronaut.core.type.Argument<?> type) - Specified by:
createSpecificin interfaceio.micronaut.json.JsonMapper
-
cloneWithConfiguration
public ObjectMapper cloneWithConfiguration(@Nullable SerdeConfiguration configuration, @Nullable SerializationConfiguration serializationConfiguration, @Nullable DeserializationConfiguration deserializationConfiguration) Description copied from interface:ObjectMapperOptional feature. Create a newObjectMapperwith the given configuration values. Anullparameter indicates the old configuration should be used.- Specified by:
cloneWithConfigurationin interfaceObjectMapper- Parameters:
configuration- TheSerdeConfigurationserializationConfiguration- TheSerializationConfigurationdeserializationConfiguration- TheDeserializationConfiguration- Returns:
- A new
JsonMapperwith the updated config
-
cloneWithConfiguration
public ObjectMapper cloneWithConfiguration(@Nullable SerdeConfiguration configuration, @Nullable SerializationConfiguration serializationConfiguration, @Nullable DeserializationConfiguration deserializationConfiguration, @Nullable SerdeIntrospections introspections) Description copied from interface:ObjectMapperOptional feature. Create a newObjectMapperwith the given configuration values and introspections. Anullconfiguration parameter indicates the old configuration should be used.- Specified by:
cloneWithConfigurationin interfaceObjectMapper- Parameters:
configuration- TheSerdeConfigurationserializationConfiguration- TheSerializationConfigurationdeserializationConfiguration- TheDeserializationConfigurationintrospections- TheSerdeIntrospections- Returns:
- A new
JsonMapperwith the updated config and introspections
-
cloneWithConfiguration
Description copied from interface:JacksonObjectMapperCreate a newJacksonObjectMapperwith the given configuration.- Specified by:
cloneWithConfigurationin interfaceJacksonObjectMapper- Parameters:
jacksonConfiguration- TheSerdeJacksonConfiguration- Returns:
- A new
JacksonObjectMapperwith the updated config
-
readValueFromTree
public <T> @Nullable T readValueFromTree(io.micronaut.json.tree.JsonNode tree, io.micronaut.core.type.Argument<T> type) throws IOException - Specified by:
readValueFromTreein interfaceio.micronaut.json.JsonMapper- Throws:
IOException
-
writeValueToTree
- Specified by:
writeValueToTreein interfaceio.micronaut.json.JsonMapper- Throws:
IOException
-
writeValueToTree
public <T> io.micronaut.json.tree.JsonNode writeValueToTree(io.micronaut.core.type.Argument<T> type, @Nullable T value) throws IOException - Specified by:
writeValueToTreein interfaceio.micronaut.json.JsonMapper- Throws:
IOException
-
readValue
public <T> @Nullable T readValue(InputStream inputStream, io.micronaut.core.type.Argument<T> type) throws IOException - Specified by:
readValuein interfaceio.micronaut.json.JsonMapper- Throws:
IOException
-
readValue
public <T> @Nullable T readValue(byte[] byteArray, io.micronaut.core.type.Argument<T> type) throws IOException - Specified by:
readValuein interfaceio.micronaut.json.JsonMapper- Throws:
IOException
-
readValue
public <T> @Nullable T readValue(io.micronaut.core.io.buffer.ByteBuffer<?> byteBuffer, io.micronaut.core.type.Argument<T> type) throws IOException - Specified by:
readValuein interfaceio.micronaut.json.JsonMapper- Throws:
IOException
-
writeValue
- Specified by:
writeValuein interfaceio.micronaut.json.JsonMapper- Throws:
IOException
-
writeValue
public <T> void writeValue(OutputStream outputStream, io.micronaut.core.type.Argument<T> type, @Nullable T object) throws IOException - Specified by:
writeValuein interfaceio.micronaut.json.JsonMapper- Throws:
IOException
-
writeValueAsBytes
- Specified by:
writeValueAsBytesin interfaceio.micronaut.json.JsonMapper- Throws:
IOException
-
writeValueAsBytes
public <T> byte[] writeValueAsBytes(io.micronaut.core.type.Argument<T> type, @Nullable T object) throws IOException - Specified by:
writeValueAsBytesin interfaceio.micronaut.json.JsonMapper- Throws:
IOException
-
getStreamConfig
public io.micronaut.json.JsonStreamConfig getStreamConfig()- Specified by:
getStreamConfigin interfaceio.micronaut.json.JsonMapper
-
createReactiveParser
public org.reactivestreams.Processor<byte[], io.micronaut.json.tree.JsonNode> createReactiveParser(Consumer<org.reactivestreams.Processor<byte[], io.micronaut.json.tree.JsonNode>> onSubscribe, boolean streamArray) - Specified by:
createReactiveParserin interfaceio.micronaut.json.JsonMapper
-
cloneWithViewClass
- Specified by:
cloneWithViewClassin interfaceio.micronaut.json.JsonMapper
-
updateValueFromTree
public void updateValueFromTree(Object value, io.micronaut.json.tree.JsonNode tree) throws IOException - Specified by:
updateValueFromTreein interfaceio.micronaut.json.JsonMapper- Throws:
IOException
-
updateValue
Description copied from interface:ObjectMapperUpdate an existing mutable value from the supplied override value.The override value is converted to a JSON tree and applied through
JsonMapper.updateValueFromTree(Object, JsonNode). Supported update semantics are implementation-specific; immutable, creator-only, and builder-only values may be rejected.- Specified by:
updateValuein interfaceObjectMapper- Type Parameters:
T- The value type- Parameters:
valueToUpdate- The existing value to updateoverrides- The override value containing fields to apply- Returns:
- The updated
valueToUpdate - Throws:
IOException- If an I/O or decoding error occurs
-
updateValue
public <T> T updateValue(T valueToUpdate, io.micronaut.core.type.Argument<T> type, @Nullable Object overrides) throws IOException Description copied from interface:ObjectMapperUpdate an existing mutable value from the supplied override value.The override value is converted to a JSON tree and applied through
JsonMapper.updateValueFromTree(Object, JsonNode). Supported update semantics are implementation-specific; immutable, creator-only, and builder-only values may be rejected.- Specified by:
updateValuein interfaceObjectMapper- Type Parameters:
T- The value type- Parameters:
valueToUpdate- The existing value to updatetype- The type of the value to updateoverrides- The override value containing fields to apply- Returns:
- The updated
valueToUpdate - Throws:
IOException- If an I/O or decoding error occurs
-
updateValue
public <T> T updateValue(T valueToUpdate, io.micronaut.core.type.Argument<T> type, InputStream inputStream) throws IOException Description copied from interface:ObjectMapperUpdate an existing mutable value from JSON read from the supplied input stream.- Specified by:
updateValuein interfaceObjectMapper- Type Parameters:
T- The value type- Parameters:
valueToUpdate- The existing value to updatetype- The type of the value to updateinputStream- The input stream containing JSON fields to apply- Returns:
- The updated
valueToUpdate - Throws:
IOException- If an I/O or decoding error occurs
-
updateValue
public <T> T updateValue(T valueToUpdate, io.micronaut.core.type.Argument<T> type, byte[] byteArray) throws IOException Description copied from interface:ObjectMapperUpdate an existing mutable value from JSON read from the supplied byte array.- Specified by:
updateValuein interfaceObjectMapper- Type Parameters:
T- The value type- Parameters:
valueToUpdate- The existing value to updatetype- The type of the value to updatebyteArray- The byte array containing JSON fields to apply- Returns:
- The updated
valueToUpdate - Throws:
IOException- If an I/O or decoding error occurs
-
updateValue
public <T> T updateValue(T valueToUpdate, io.micronaut.core.type.Argument<T> type, io.micronaut.core.io.buffer.ByteBuffer<?> byteBuffer) throws IOException Description copied from interface:ObjectMapperUpdate an existing mutable value from JSON read from the supplied byte buffer.- Specified by:
updateValuein interfaceObjectMapper- Type Parameters:
T- The value type- Parameters:
valueToUpdate- The existing value to updatetype- The type of the value to updatebyteBuffer- The byte buffer containing JSON fields to apply- Returns:
- The updated
valueToUpdate - Throws:
IOException- If an I/O or decoding error occurs
-