Class XmlGenerator

java.lang.Object
io.micronaut.serde.xml.XmlGenerator
All Implemented Interfaces:
Encoder, KeysAwareEncoder, AutoCloseable

@Internal public final class XmlGenerator extends Object implements KeysAwareEncoder
An Encoder that serializes objects to XML using a StAX XMLStreamWriter.
Since:
3.2
  • Method Details

    • encodeArray

      public 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 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 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
    • encodeKey

      public void encodeKey(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
    • encodeKey

      public void encodeKey(Keys keys, int index) throws IOException
      Description copied from interface: KeysAwareEncoder
      Encode a key by index from the supplied key set.
      Specified by:
      encodeKey in interface KeysAwareEncoder
      Parameters:
      keys - The keys
      index - The key index
      Throws:
      IOException - If an unrecoverable error occurs
    • encodeString

      public void encodeString(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 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 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
    • encodeBinary

      public void encodeBinary(byte[] data) throws IOException
      Description copied from interface: Encoder
      Encode the given binary data. The shape of the data in the output is unspecified, the only requirement is that the equivalent Decoder.decodeBinary() must be able to parse to the same data.
      Specified by:
      encodeBinary in interface Encoder
      Parameters:
      data - The input data
      Throws:
      IOException
    • encodeShort

      public 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 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 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 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 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 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 void encodeBigInteger(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 void encodeBigDecimal(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 void encodeNull() throws IOException
      Description copied from interface: Encoder
      Encode null.
      Specified by:
      encodeNull in interface Encoder
      Throws:
      IOException - If an error occurs