org.apache.avro.data

## Class Json.ObjectWriter

- java.lang.Object
- - org.apache.avro.data.Json.ObjectWriter

- All Implemented Interfaces:
    DatumWriter<Object>
  Enclosing class:
    Json

      public static class Json.ObjectWriter
      extends Object
      implements DatumWriter<Object>

  `DatumWriter` for arbitrary Json data using the object model described in `JsonProperties`.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ObjectWriter()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `setSchema(Schema schema)` Set the schema.
    `void` | `write(Object datum, Encoder out)` Write a datum.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ObjectWriter

          public ObjectWriter()

  - ### Method Detail

    - #### setSchema

          public void setSchema(Schema schema)

      Description copied from interface: `DatumWriter`
      Set the schema.
      Specified by:
        `setSchema` in interface `DatumWriter<Object>`

    - #### write

          public void write(Object datum,
                            Encoder out)
                     throws IOException

      Description copied from interface: `DatumWriter`
      Write a datum. Traverse the schema, depth first, writing each leaf value in the schema from the datum to the output.
      Specified by:
        `write` in interface `DatumWriter<Object>`
      Throws:
        `IOException`

Copyright © 2009–2024 The Apache Software Foundation. All rights reserved.