Class JsonNodeEncoder

java.lang.Object
io.micronaut.serde.support.util.JsonNodeEncoder
All Implemented Interfaces:
Encoder, AutoCloseable

public abstract class JsonNodeEncoder extends Object implements Encoder
Implementation of the Encoder interface that encodes a in-memory JsonNode.
  • Method Details

    • create

      @NonNull public static JsonNodeEncoder create()
      Creates a new instance.
      Returns:
      The JsonNodeEncoder
    • encodeValue

      protected abstract void encodeValue(io.micronaut.json.tree.JsonNode node)
      Encode the given value.
      Parameters:
      node - The node to encode
    • encodeString

      public void encodeString(String value)
      Description copied from interface: Encoder
      Encode a string.
      Specified by:
      encodeString in interface Encoder
      Parameters:
      value - The string, never null
    • encodeBoolean

      public void encodeBoolean(boolean value)
      Description copied from interface: Encoder
      Encode a boolean.
      Specified by:
      encodeBoolean in interface Encoder
      Parameters:
      value - The boolean
    • encodeByte

      public void encodeByte(byte value)
      Description copied from interface: Encoder
      Encode a byte.
      Specified by:
      encodeByte in interface Encoder
      Parameters:
      value - The byte
    • encodeShort

      public void encodeShort(short value)
      Description copied from interface: Encoder
      Encode a short.
      Specified by:
      encodeShort in interface Encoder
      Parameters:
      value - The short
    • encodeChar

      public void encodeChar(char value)
      Description copied from interface: Encoder
      Encode a char.
      Specified by:
      encodeChar in interface Encoder
      Parameters:
      value - The char
    • encodeInt

      public void encodeInt(int value)
      Description copied from interface: Encoder
      Encode an int.
      Specified by:
      encodeInt in interface Encoder
      Parameters:
      value - The int
    • encodeLong

      public void encodeLong(long value)
      Description copied from interface: Encoder
      Encode a long.
      Specified by:
      encodeLong in interface Encoder
      Parameters:
      value - The long
    • encodeFloat

      public void encodeFloat(float value)
      Description copied from interface: Encoder
      Encode a float.
      Specified by:
      encodeFloat in interface Encoder
      Parameters:
      value - The float
    • encodeDouble

      public void encodeDouble(double value)
      Description copied from interface: Encoder
      Encode a double.
      Specified by:
      encodeDouble in interface Encoder
      Parameters:
      value - The double
    • encodeBigInteger

      public void encodeBigInteger(BigInteger value)
      Description copied from interface: Encoder
      Encode a BigInteger.
      Specified by:
      encodeBigInteger in interface Encoder
      Parameters:
      value - The BigInteger, never null
    • encodeBigDecimal

      public void encodeBigDecimal(BigDecimal value)
      Description copied from interface: Encoder
      Encode a BigDecimal.
      Specified by:
      encodeBigDecimal in interface Encoder
      Parameters:
      value - The BigDecimal, never null
    • encodeNull

      public void encodeNull()
      Description copied from interface: Encoder
      Encode null.
      Specified by:
      encodeNull in interface Encoder
    • encodeArray

      public Encoder encodeArray(io.micronaut.core.type.Argument<?> type)
      Description copied from interface: Encoder
      Encodes an array.
      Specified by:
      encodeArray in interface Encoder
      Parameters:
      type - The array type, never null
      Returns:
      The encoder, never null
    • encodeObject

      public Encoder encodeObject(io.micronaut.core.type.Argument<?> type)
      Description copied from interface: Encoder
      Encodes an object.
      Specified by:
      encodeObject in interface Encoder
      Parameters:
      type - The object type, never null
      Returns:
      The encoder, never null
    • getCompletedValue

      @NonNull public io.micronaut.json.tree.JsonNode getCompletedValue()
      Obtains the completed value.
      Returns:
      The materialized JsonNode