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.
  • Constructor Details

  • Method Details

    • getSerdeRegistry

      public SerdeRegistry getSerdeRegistry()
      Description copied from interface: ObjectMapper
      Returns the SerdeRegistry used by this object mapper, if possible.
      Specified by:
      getSerdeRegistry in interface ObjectMapper
      Returns:
      The serde registry
    • createSpecific

      public io.micronaut.json.JsonMapper createSpecific(io.micronaut.core.type.Argument<?> type)
      Specified by:
      createSpecific in interface io.micronaut.json.JsonMapper
    • cloneWithConfiguration

      public ObjectMapper cloneWithConfiguration(@Nullable SerdeConfiguration configuration, @Nullable SerializationConfiguration serializationConfiguration, @Nullable DeserializationConfiguration deserializationConfiguration)
      Description copied from interface: ObjectMapper
      Optional feature. Create a new ObjectMapper with the given configuration values. A null parameter indicates the old configuration should be used.
      Specified by:
      cloneWithConfiguration in interface ObjectMapper
      Parameters:
      configuration - The SerdeConfiguration
      serializationConfiguration - The SerializationConfiguration
      deserializationConfiguration - The DeserializationConfiguration
      Returns:
      A new JsonMapper with the updated config
    • cloneWithConfiguration

      public ObjectMapper cloneWithConfiguration(@Nullable SerdeConfiguration configuration, @Nullable SerializationConfiguration serializationConfiguration, @Nullable DeserializationConfiguration deserializationConfiguration, @Nullable SerdeIntrospections introspections)
      Description copied from interface: ObjectMapper
      Optional feature. Create a new ObjectMapper with the given configuration values and introspections. A null configuration parameter indicates the old configuration should be used.
      Specified by:
      cloneWithConfiguration in interface ObjectMapper
      Parameters:
      configuration - The SerdeConfiguration
      serializationConfiguration - The SerializationConfiguration
      deserializationConfiguration - The DeserializationConfiguration
      introspections - The SerdeIntrospections
      Returns:
      A new JsonMapper with the updated config and introspections
    • cloneWithConfiguration

      public JacksonObjectMapper cloneWithConfiguration(SerdeJacksonConfiguration jacksonConfiguration)
      Description copied from interface: JacksonObjectMapper
      Create a new JacksonObjectMapper with the given configuration.
      Specified by:
      cloneWithConfiguration in interface JacksonObjectMapper
      Parameters:
      jacksonConfiguration - The SerdeJacksonConfiguration
      Returns:
      A new JacksonObjectMapper with 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:
      readValueFromTree in interface io.micronaut.json.JsonMapper
      Throws:
      IOException
    • writeValueToTree

      public io.micronaut.json.tree.JsonNode writeValueToTree(@Nullable Object value) throws IOException
      Specified by:
      writeValueToTree in interface io.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:
      writeValueToTree in interface io.micronaut.json.JsonMapper
      Throws:
      IOException
    • readValue

      public <T> @Nullable T readValue(InputStream inputStream, io.micronaut.core.type.Argument<T> type) throws IOException
      Specified by:
      readValue in interface io.micronaut.json.JsonMapper
      Throws:
      IOException
    • readValue

      public <T> @Nullable T readValue(byte[] byteArray, io.micronaut.core.type.Argument<T> type) throws IOException
      Specified by:
      readValue in interface io.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:
      readValue in interface io.micronaut.json.JsonMapper
      Throws:
      IOException
    • writeValue

      public void writeValue(OutputStream outputStream, @Nullable Object object) throws IOException
      Specified by:
      writeValue in interface io.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:
      writeValue in interface io.micronaut.json.JsonMapper
      Throws:
      IOException
    • writeValueAsBytes

      public byte[] writeValueAsBytes(@Nullable Object object) throws IOException
      Specified by:
      writeValueAsBytes in interface io.micronaut.json.JsonMapper
      Throws:
      IOException
    • writeValueAsBytes

      public <T> byte[] writeValueAsBytes(io.micronaut.core.type.Argument<T> type, @Nullable T object) throws IOException
      Specified by:
      writeValueAsBytes in interface io.micronaut.json.JsonMapper
      Throws:
      IOException
    • getStreamConfig

      public io.micronaut.json.JsonStreamConfig getStreamConfig()
      Specified by:
      getStreamConfig in interface io.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:
      createReactiveParser in interface io.micronaut.json.JsonMapper
    • cloneWithViewClass

      public io.micronaut.json.JsonMapper cloneWithViewClass(Class<?> viewClass)
      Specified by:
      cloneWithViewClass in interface io.micronaut.json.JsonMapper
    • updateValueFromTree

      public void updateValueFromTree(Object value, io.micronaut.json.tree.JsonNode tree) throws IOException
      Specified by:
      updateValueFromTree in interface io.micronaut.json.JsonMapper
      Throws:
      IOException
    • updateValue

      public <T> T updateValue(T valueToUpdate, @Nullable Object overrides) throws IOException
      Description copied from interface: ObjectMapper
      Update 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:
      updateValue in interface ObjectMapper
      Type Parameters:
      T - The value type
      Parameters:
      valueToUpdate - The existing value to update
      overrides - 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: ObjectMapper
      Update 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:
      updateValue in interface ObjectMapper
      Type Parameters:
      T - The value type
      Parameters:
      valueToUpdate - The existing value to update
      type - The type of the value to update
      overrides - 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: ObjectMapper
      Update an existing mutable value from JSON read from the supplied input stream.
      Specified by:
      updateValue in interface ObjectMapper
      Type Parameters:
      T - The value type
      Parameters:
      valueToUpdate - The existing value to update
      type - The type of the value to update
      inputStream - 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: ObjectMapper
      Update an existing mutable value from JSON read from the supplied byte array.
      Specified by:
      updateValue in interface ObjectMapper
      Type Parameters:
      T - The value type
      Parameters:
      valueToUpdate - The existing value to update
      type - The type of the value to update
      byteArray - 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: ObjectMapper
      Update an existing mutable value from JSON read from the supplied byte buffer.
      Specified by:
      updateValue in interface ObjectMapper
      Type Parameters:
      T - The value type
      Parameters:
      valueToUpdate - The existing value to update
      type - The type of the value to update
      byteBuffer - The byte buffer containing JSON fields to apply
      Returns:
      The updated valueToUpdate
      Throws:
      IOException - If an I/O or decoding error occurs