de.caff.io.json

## Class SimpleJsonReader.ArrayHandler

- java.lang.Object
- - de.caff.io.json.SimpleJsonReader.ArrayHandler

- All Implemented Interfaces:
    SimpleJsonReader.Handler, SimpleJsonReader.TemporaryHandler
  Enclosing class:
    SimpleJsonReader

      public abstract static class SimpleJsonReader.ArrayHandler
      extends java.lang.Object
      implements SimpleJsonReader.TemporaryHandler

  Dedicated array handler.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ArrayHandler()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected abstract SimpleJsonReader.TemporaryHandler` | `arrayElement(int index)` Called when the beginning of an array sub-element was read.
    `void` | `beginArray(SimpleJsonReader reader)` Called when an array is started.
    `void` | `beginObject(SimpleJsonReader reader)` Called when an object is started.
    `protected abstract void` | `element(int index, boolean v)` Called when a boolean element was read.
    `protected abstract void` | `element(int index, java.lang.Number v)` Called when a number value was read.
    `protected abstract void` | `element(int index, java.lang.String v)` Called when a text element was read.
    `void` | `endArray(SimpleJsonReader reader)` Called when an array has ended.
    `void` | `endObject(SimpleJsonReader reader)` Called when an object has ended.
    `void` | `key(SimpleJsonReader reader, java.lang.String key)` Called when a key ways read.
    `protected abstract void` | `nullElement(int index)` Called when a null element was read.
    `void` | `nullValue(SimpleJsonReader reader)` Called when a null value was read.
    `protected abstract SimpleJsonReader.TemporaryHandler` | `objectElement(int index)` Called when the beginning of an object element was read.
    `void` | `value(SimpleJsonReader reader, boolean v)` Called when a boolean value was read.
    `void` | `value(SimpleJsonReader reader, java.lang.Number v)` Called when a number value was read.
    `void` | `value(SimpleJsonReader reader, java.lang.String v)` Called when a text value was read.

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

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

    - ### Methods inherited from interface de.caff.io.json.SimpleJsonReader.TemporaryHandler

      `finish, initialize`

- - ### Constructor Detail

    - #### ArrayHandler

          public ArrayHandler()

  - ### Method Detail

    - #### key

          public void key(@NotNull
                          SimpleJsonReader reader,
                          @NotNull
                          java.lang.String key)

      Description copied from interface: `SimpleJsonReader.Handler`
      Called when a key ways read. Next is either a value, a SimpleJsonReader.Handler.beginObject(SimpleJsonReader), or SimpleJsonReader.Handler.beginArray(SimpleJsonReader) .
      Specified by:
        `key` in interface `SimpleJsonReader.Handler`
      Parameters:
        `reader` - reader which has read the key
        `key` - the value of the key

    - #### beginObject

          public void beginObject(@NotNull
                                  SimpleJsonReader reader)

      Description copied from interface: `SimpleJsonReader.Handler`
      Called when an object is started. Next is either a SimpleJsonReader.Handler.key(SimpleJsonReader, String) or an SimpleJsonReader.Handler.endObject(SimpleJsonReader).
      Specified by:
        `beginObject` in interface `SimpleJsonReader.Handler`
      Parameters:
        `reader` - reader which is reading the object

    - #### endObject

          public void endObject(@NotNull
                                SimpleJsonReader reader)

      Description copied from interface: `SimpleJsonReader.Handler`
      Called when an object has ended.
      Specified by:
        `endObject` in interface `SimpleJsonReader.Handler`
      Parameters:
        `reader` - reader which has read the object

    - #### beginArray

          public void beginArray(@NotNull
                                 SimpleJsonReader reader)

      Description copied from interface: `SimpleJsonReader.Handler`
      Called when an array is started.
      Specified by:
        `beginArray` in interface `SimpleJsonReader.Handler`
      Parameters:
        `reader` - reader which is reading the array

    - #### endArray

          public void endArray(@NotNull
                               SimpleJsonReader reader)

      Description copied from interface: `SimpleJsonReader.Handler`
      Called when an array has ended.
      Specified by:
        `endArray` in interface `SimpleJsonReader.Handler`
      Parameters:
        `reader` - reader which has read the array

    - #### nullValue

          public void nullValue(@NotNull
                                SimpleJsonReader reader)

      Description copied from interface: `SimpleJsonReader.Handler`
      Called when a null value was read.
      Specified by:
        `nullValue` in interface `SimpleJsonReader.Handler`
      Parameters:
        `reader` - reader which has read the value

    - #### value

          public void value(@NotNull
                            SimpleJsonReader reader,
                            @NotNull
                            java.lang.String v)

      Description copied from interface: `SimpleJsonReader.Handler`
      Called when a text value was read.
      Specified by:
        `value` in interface `SimpleJsonReader.Handler`
      Parameters:
        `reader` - reader which has read the value
        `v` - text value

    - #### value

          public void value(@NotNull
                            SimpleJsonReader reader,
                            boolean v)

      Description copied from interface: `SimpleJsonReader.Handler`
      Called when a boolean value was read.
      Specified by:
        `value` in interface `SimpleJsonReader.Handler`
      Parameters:
        `reader` - reader which has read the value
        `v` - boolean value

    - #### value

          public void value(@NotNull
                            SimpleJsonReader reader,
                            @NotNull
                            java.lang.Number v)

      Description copied from interface: `SimpleJsonReader.Handler`
      Called when a number value was read.
      Specified by:
        `value` in interface `SimpleJsonReader.Handler`
      Parameters:
        `reader` - reader which has read the value
        `v` - number value, implementation will provide either an `Integer` (if fit), or a `Double`

    - #### objectElement

          @NotNull
          protected abstract SimpleJsonReader.TemporaryHandler objectElement(int index)

      Called when the beginning of an object element was read. Expected to return a dedicated reader which is used to read the content of the object. The handler will be initialized with its `SimpleJsonReader.TemporaryHandler.initialize(SimpleJsonReader)` method, then be used to handle the key-value pairs inside the object. When the object is finished, the handler's `SimpleJsonReader.TemporaryHandler.finish(SimpleJsonReader)` method is called.

      If the key is unsupported either throw an exception or return `SimpleJsonReader.SKIP_HANDLER` which will ignore the object.

      Parameters:
        `index` - index of the array element which is read
      Returns:
        dedicated reader for the object, usually an `SimpleJsonReader.ObjectHandler`

    - #### arrayElement

          @NotNull
          protected abstract SimpleJsonReader.TemporaryHandler arrayElement(int index)

      Called when the beginning of an array sub-element was read. Expected to return a dedicated reader which is used to read the content of the array. The handler will be initialized with its `SimpleJsonReader.TemporaryHandler.initialize(SimpleJsonReader)` method, then be used to handle the key-value pairs inside the object. When the object is finished, the handler's `SimpleJsonReader.TemporaryHandler.finish(SimpleJsonReader)` method is called.

      If the key is unsupported either throw an exception or return `SimpleJsonReader.SKIP_HANDLER` which will ignore the object.

      Parameters:
        `index` - index of the array element which is read
      Returns:
        dedicated reader for the object, usually another `SimpleJsonReader.ArrayHandler`

    - #### nullElement

          protected abstract void nullElement(int index)

      Called when a null element was read.
      Parameters:
        `index` - index of the array element which is read

    - #### element

          protected abstract void element(int index,
                                          @NotNull
                                          java.lang.String v)

      Called when a text element was read.
      Parameters:
        `index` - index of the array element which is read
        `v` - text value

    - #### element

          protected abstract void element(int index,
                                          boolean v)

      Called when a boolean element was read.
      Parameters:
        `index` - index of the array element which is read
        `v` - boolean value

    - #### element

          protected abstract void element(int index,
                                          @NotNull
                                          java.lang.Number v)

      Called when a number value was read.
      Parameters:
        `index` - index of the array element which is read
        `v` - number value, implementation will provide either an `Integer` (if fit), or a `Double`