Class JacksonOpenApiJsonMapper
java.lang.Object
io.micronaut.openapi.jackson.JacksonOpenApiJsonMapper
- All Implemented Interfaces:
io.micronaut.json.JsonMapper
A
JsonMapper backed by a Jackson ObjectMapper.
Trees are exchanged as Micronaut JsonNode instances, converted through plain Java maps, lists and
scalars. Jackson exceptions are rethrown as IOException, matching the JsonMapper contract.
- Since:
- 8.0.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiontools.jackson.databind.ObjectMapperio.micronaut.json.JsonStreamConfig<T> TreadValue(byte[] byteArray, io.micronaut.core.type.Argument<T> type) <T> TreadValue(InputStream inputStream, io.micronaut.core.type.Argument<T> type) <T> T<T> TreadValueFromTree(io.micronaut.json.tree.JsonNode tree, io.micronaut.core.type.Argument<T> type) <T> TupdateValue(T value, io.micronaut.json.tree.JsonNode tree) Updates a value from a tree withObjectMapper.readerForUpdating(Object).voidupdateValueFromTree(Object value, io.micronaut.json.tree.JsonNode tree) <T> voidwriteValue(OutputStream outputStream, io.micronaut.core.type.Argument<T> type, T object) voidwriteValue(OutputStream outputStream, @Nullable Object object) <T> byte[]writeValueAsBytes(io.micronaut.core.type.Argument<T> type, T object) byte[]writeValueAsBytes(@Nullable Object object) writeValueAsString(@Nullable Object object) <T> io.micronaut.json.tree.JsonNodewriteValueToTree(io.micronaut.core.type.Argument<T> type, 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
cloneWithFeatures, cloneWithViewClass, createReactiveParser, createSpecific, detectFeatures, readValue, readValue, readValue, readValue, readValue, readValueFromTree, writeValueAsString, writeValueAsString
-
Constructor Details
-
JacksonOpenApiJsonMapper
public JacksonOpenApiJsonMapper(tools.jackson.databind.ObjectMapper objectMapper) - Parameters:
objectMapper- The Jackson mapper to delegate to
-
-
Method Details
-
getObjectMapper
public tools.jackson.databind.ObjectMapper getObjectMapper()- Returns:
- The underlying Jackson mapper
-
readValueFromTree
@Nullable public <T> 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
-
readValue
@Nullable public <T> T readValue(InputStream inputStream, io.micronaut.core.type.Argument<T> type) throws IOException - Specified by:
readValuein interfaceio.micronaut.json.JsonMapper- Throws:
IOException
-
readValue
@Nullable public <T> T readValue(byte[] byteArray, io.micronaut.core.type.Argument<T> type) throws IOException - Specified by:
readValuein interfaceio.micronaut.json.JsonMapper- Throws:
IOException
-
readValue
@Nullable public <T> T readValue(String string, io.micronaut.core.type.Argument<T> type) throws IOException - Specified by:
readValuein interfaceio.micronaut.json.JsonMapper- Throws:
IOException
-
writeValueToTree
public io.micronaut.json.tree.JsonNode writeValueToTree(@Nullable @Nullable Object value) throws IOException - 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
-
writeValue
public void writeValue(OutputStream outputStream, @Nullable @Nullable Object object) throws IOException - 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
-
writeValueAsString
- Specified by:
writeValueAsStringin interfaceio.micronaut.json.JsonMapper- Throws:
IOException
-
updateValueFromTree
public void updateValueFromTree(Object value, io.micronaut.json.tree.JsonNode tree) throws IOException - Specified by:
updateValueFromTreein interfaceio.micronaut.json.JsonMapper- Throws:
IOException
-
updateValue
Updates a value from a tree withObjectMapper.readerForUpdating(Object).- Type Parameters:
T- The value type- Parameters:
value- The value to updatetree- The tree- Returns:
- The result, which is a new instance if the type's deserializer cannot merge into an existing one
- Throws:
IOException- if the tree cannot be read
-
getStreamConfig
public io.micronaut.json.JsonStreamConfig getStreamConfig()- Specified by:
getStreamConfigin interfaceio.micronaut.json.JsonMapper
-