Package io.micronaut.serde.jackson
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 io.micronaut.serde.ObjectMapper
ObjectMapper.CloseableObjectMapper
-
Constructor Summary
ConstructorDescriptionJacksonJsonMapper
(SerdeRegistry registry, SerdeConfiguration serdeConfiguration, SerdeJacksonConfiguration jacksonConfiguration) -
Method Summary
Modifier and TypeMethodDescriptioncloneWithConfiguration
(@Nullable SerdeConfiguration configuration, @Nullable SerializationConfiguration serializationConfiguration, @Nullable DeserializationConfiguration deserializationConfiguration) Optional feature.cloneWithConfiguration
(SerdeJacksonConfiguration jacksonConfiguration) Create a newJacksonObjectMapper
with the given configuration.@NonNull io.micronaut.json.JsonMapper
cloneWithViewClass
(@NonNull Class<?> viewClass) @NonNull org.reactivestreams.Processor<byte[],
io.micronaut.json.tree.JsonNode> createReactiveParser
(Consumer<org.reactivestreams.Processor<byte[], io.micronaut.json.tree.JsonNode>> onSubscribe, boolean streamArray) @NonNull io.micronaut.json.JsonMapper
createSpecific
(@NonNull io.micronaut.core.type.Argument<?> type) @NonNull io.micronaut.json.JsonStreamConfig
<T> T
readValue
(@io.micronaut.core.annotation.NonNull byte[] byteArray, @NonNull io.micronaut.core.type.Argument<T> type) <T> T
readValue
(@NonNull io.micronaut.core.io.buffer.ByteBuffer<?> byteBuffer, @NonNull io.micronaut.core.type.Argument<T> type) <T> T
readValue
(@NonNull InputStream inputStream, @NonNull io.micronaut.core.type.Argument<T> type) <T> T
readValueFromTree
(@NonNull io.micronaut.json.tree.JsonNode tree, @NonNull io.micronaut.core.type.Argument<T> type) void
updateValueFromTree
(Object value, io.micronaut.json.tree.JsonNode tree) void
writeValue
(@NonNull OutputStream outputStream, @Nullable Object object) <T> void
writeValue
(OutputStream outputStream, io.micronaut.core.type.Argument<T> type, T object) byte[]
writeValueAsBytes
(@Nullable Object object) <T> byte[]
writeValueAsBytes
(io.micronaut.core.type.Argument<T> type, T object) @NonNull io.micronaut.json.tree.JsonNode
writeValueToTree
(@Nullable Object value) <T> io.micronaut.json.tree.JsonNode
writeValueToTree
(io.micronaut.core.type.Argument<T> type, T value) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.json.JsonMapper
detectFeatures, readValue, readValue, readValue, readValue, readValueFromTree, writeValueAsString, writeValueAsString
Methods inherited from interface io.micronaut.serde.ObjectMapper
cloneWithFeatures, writeValueAsString
-
Constructor Details
-
JacksonJsonMapper
@Inject @Internal public JacksonJsonMapper(SerdeRegistry registry, SerdeConfiguration serdeConfiguration, SerdeJacksonConfiguration jacksonConfiguration)
-
-
Method Details
-
createSpecific
@NonNull public @NonNull io.micronaut.json.JsonMapper createSpecific(@NonNull @NonNull io.micronaut.core.type.Argument<?> type) - Specified by:
createSpecific
in interfaceio.micronaut.json.JsonMapper
-
cloneWithConfiguration
public ObjectMapper cloneWithConfiguration(@Nullable @Nullable SerdeConfiguration configuration, @Nullable @Nullable SerializationConfiguration serializationConfiguration, @Nullable @Nullable DeserializationConfiguration deserializationConfiguration) Description copied from interface:ObjectMapper
Optional feature. Create a newObjectMapper
with the given configuration values. Anull
parameter indicates the old configuration should be used.- Specified by:
cloneWithConfiguration
in interfaceObjectMapper
- Parameters:
configuration
- TheSerdeConfiguration
serializationConfiguration
- TheSerializationConfiguration
deserializationConfiguration
- TheDeserializationConfiguration
- Returns:
- A new
JsonMapper
with the updated config
-
cloneWithConfiguration
Description copied from interface:JacksonObjectMapper
Create a newJacksonObjectMapper
with the given configuration.- Specified by:
cloneWithConfiguration
in interfaceJacksonObjectMapper
- Parameters:
jacksonConfiguration
- TheSerdeJacksonConfiguration
- Returns:
- A new
JacksonObjectMapper
with the updated config
-
readValueFromTree
public <T> T readValueFromTree(@NonNull @NonNull io.micronaut.json.tree.JsonNode tree, @NonNull @NonNull io.micronaut.core.type.Argument<T> type) throws IOException - Specified by:
readValueFromTree
in interfaceio.micronaut.json.JsonMapper
- Throws:
IOException
-
writeValueToTree
@NonNull public @NonNull io.micronaut.json.tree.JsonNode writeValueToTree(@Nullable @Nullable Object value) throws IOException - Specified by:
writeValueToTree
in interfaceio.micronaut.json.JsonMapper
- Throws:
IOException
-
writeValueToTree
public <T> io.micronaut.json.tree.JsonNode writeValueToTree(io.micronaut.core.type.Argument<T> type, T value) throws IOException - Specified by:
writeValueToTree
in interfaceio.micronaut.json.JsonMapper
- Throws:
IOException
-
readValue
public <T> T readValue(@NonNull @NonNull InputStream inputStream, @NonNull @NonNull io.micronaut.core.type.Argument<T> type) throws IOException - Specified by:
readValue
in interfaceio.micronaut.json.JsonMapper
- Throws:
IOException
-
readValue
public <T> T readValue(@NonNull @io.micronaut.core.annotation.NonNull byte[] byteArray, @NonNull @NonNull io.micronaut.core.type.Argument<T> type) throws IOException - Specified by:
readValue
in interfaceio.micronaut.json.JsonMapper
- Throws:
IOException
-
readValue
public <T> T readValue(@NonNull @NonNull io.micronaut.core.io.buffer.ByteBuffer<?> byteBuffer, @NonNull @NonNull io.micronaut.core.type.Argument<T> type) throws IOException - Specified by:
readValue
in interfaceio.micronaut.json.JsonMapper
- Throws:
IOException
-
writeValue
public void writeValue(@NonNull @NonNull OutputStream outputStream, @Nullable @Nullable Object object) throws IOException - Specified by:
writeValue
in interfaceio.micronaut.json.JsonMapper
- Throws:
IOException
-
writeValue
public <T> void writeValue(OutputStream outputStream, io.micronaut.core.type.Argument<T> type, T object) throws IOException - Specified by:
writeValue
in interfaceio.micronaut.json.JsonMapper
- Throws:
IOException
-
writeValueAsBytes
- Specified by:
writeValueAsBytes
in interfaceio.micronaut.json.JsonMapper
- Throws:
IOException
-
writeValueAsBytes
public <T> byte[] writeValueAsBytes(io.micronaut.core.type.Argument<T> type, T object) throws IOException - Specified by:
writeValueAsBytes
in interfaceio.micronaut.json.JsonMapper
- Throws:
IOException
-
getStreamConfig
@NonNull public @NonNull io.micronaut.json.JsonStreamConfig getStreamConfig()- Specified by:
getStreamConfig
in interfaceio.micronaut.json.JsonMapper
-
createReactiveParser
@NonNull public @NonNull 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:
createReactiveParser
in interfaceio.micronaut.json.JsonMapper
-
cloneWithViewClass
@NonNull public @NonNull io.micronaut.json.JsonMapper cloneWithViewClass(@NonNull @NonNull Class<?> viewClass) - Specified by:
cloneWithViewClass
in interfaceio.micronaut.json.JsonMapper
-
updateValueFromTree
public void updateValueFromTree(Object value, io.micronaut.json.tree.JsonNode tree) throws IOException - Specified by:
updateValueFromTree
in interfaceio.micronaut.json.JsonMapper
- Throws:
IOException
-