Class JacksonEncoder

java.lang.Object
io.micronaut.serde.jackson.JacksonEncoder
All Implemented Interfaces:
Encoder, AutoCloseable

public abstract class JacksonEncoder extends Object implements Encoder
Implementation of the Encoder interface for Jackson.
  • Field Details

    • generator

      protected final com.fasterxml.jackson.core.JsonGenerator generator
  • Method Details

    • create

      public static Encoder create(@NonNull com.fasterxml.jackson.core.JsonGenerator generator)
    • encodeArray

      public final Encoder encodeArray(io.micronaut.core.type.Argument<?> type) throws IOException
      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
      Throws:
      IOException - if an error occurs
    • encodeObject

      public final Encoder encodeObject(io.micronaut.core.type.Argument<?> type) throws IOException
      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
      Throws:
      IOException - if an error occurs
    • finishStructure

      public final void finishStructure() throws IOException
      Description copied from interface: Encoder
      Finalize a previously created structure, like an array or object.
      Specified by:
      finishStructure in interface Encoder
      Throws:
      IOException - If an error occurs
    • close

      public final void close() throws IOException
      Description copied from interface: Encoder
      Finalize the current structure. Equivalent to calling Encoder.finishStructure().
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Encoder
      Throws:
      IOException - If an unrecoverable error occurs
    • finishStructureToken

      protected abstract void finishStructureToken() throws IOException
      Throws:
      IOException
    • currentPath

      public String currentPath()
      Description copied from interface: Encoder
      Return an analysis of the current path.
      Specified by:
      currentPath in interface Encoder
      Returns:
      The current path if known
    • encodeKey

      public final void encodeKey(@NonNull String key) throws IOException
      Description copied from interface: Encoder
      Encode a key.
      Specified by:
      encodeKey in interface Encoder
      Parameters:
      key - The key, never null
      Throws:
      IOException - If an error occurs
    • encodeString

      public final void encodeString(@NonNull String value) throws IOException
      Description copied from interface: Encoder
      Encode a string.
      Specified by:
      encodeString in interface Encoder
      Parameters:
      value - The string, never null
      Throws:
      IOException - If an error occurs
    • encodeBoolean

      public final void encodeBoolean(boolean value) throws IOException
      Description copied from interface: Encoder
      Encode a boolean.
      Specified by:
      encodeBoolean in interface Encoder
      Parameters:
      value - The boolean
      Throws:
      IOException - If an error occurs
    • encodeByte

      public final void encodeByte(byte value) throws IOException
      Description copied from interface: Encoder
      Encode a byte.
      Specified by:
      encodeByte in interface Encoder
      Parameters:
      value - The byte
      Throws:
      IOException - If an error occurs
    • encodeShort

      public final void encodeShort(short value) throws IOException
      Description copied from interface: Encoder
      Encode a short.
      Specified by:
      encodeShort in interface Encoder
      Parameters:
      value - The short
      Throws:
      IOException - If an error occurs
    • encodeChar

      public final void encodeChar(char value) throws IOException
      Description copied from interface: Encoder
      Encode a char.
      Specified by:
      encodeChar in interface Encoder
      Parameters:
      value - The char
      Throws:
      IOException - If an error occurs
    • encodeInt

      public final void encodeInt(int value) throws IOException
      Description copied from interface: Encoder
      Encode an int.
      Specified by:
      encodeInt in interface Encoder
      Parameters:
      value - The int
      Throws:
      IOException - If an error occurs
    • encodeLong

      public final void encodeLong(long value) throws IOException
      Description copied from interface: Encoder
      Encode a long.
      Specified by:
      encodeLong in interface Encoder
      Parameters:
      value - The long
      Throws:
      IOException - If an error occurs
    • encodeFloat

      public final void encodeFloat(float value) throws IOException
      Description copied from interface: Encoder
      Encode a float.
      Specified by:
      encodeFloat in interface Encoder
      Parameters:
      value - The float
      Throws:
      IOException - If an error occurs
    • encodeDouble

      public final void encodeDouble(double value) throws IOException
      Description copied from interface: Encoder
      Encode a double.
      Specified by:
      encodeDouble in interface Encoder
      Parameters:
      value - The double
      Throws:
      IOException - If an error occurs
    • encodeBigInteger

      public final void encodeBigInteger(@NonNull BigInteger value) throws IOException
      Description copied from interface: Encoder
      Encode a BigInteger.
      Specified by:
      encodeBigInteger in interface Encoder
      Parameters:
      value - The BigInteger, never null
      Throws:
      IOException - If an error occurs
    • encodeBigDecimal

      public final void encodeBigDecimal(@NonNull BigDecimal value) throws IOException
      Description copied from interface: Encoder
      Encode a BigDecimal.
      Specified by:
      encodeBigDecimal in interface Encoder
      Parameters:
      value - The BigDecimal, never null
      Throws:
      IOException - If an error occurs
    • encodeNull

      public final void encodeNull() throws IOException
      Description copied from interface: Encoder
      Encode null.
      Specified by:
      encodeNull in interface Encoder
      Throws:
      IOException - If an error occurs