de.caff.io.json

## Class AbstractSimpleJsonFilter

- java.lang.Object
- - de.caff.io.json.AbstractSimpleJsonFilter

- All Implemented Interfaces:
    SimpleJsonReader.Handler

      public abstract class AbstractSimpleJsonFilter
      extends java.lang.Object
      implements SimpleJsonReader.Handler

  Abstract basic low-level JSON filter. This acts as a handler for a `SimpleJsonReader` and writes its output to the wrapped `SimpleJsonWriter`.

  This class is thought for simple transformations like exchanging a key or value.

  This default implementation just forwards everything to the writer. Extending classes may intercept where they seem fit.

  Since:
    June 02, 2022
  Author:
    Rammi

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `AbstractSimpleJsonFilter(SimpleJsonWriter writer)` Constructor.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `beginArray(SimpleJsonReader reader)` Called when an array is started.
    `void` | `beginObject(SimpleJsonReader reader)` Called when an object is started.
    `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.
    `void` | `nullValue(SimpleJsonReader reader)` Called when a null value 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`

- - ### Constructor Detail

    - #### AbstractSimpleJsonFilter

          protected AbstractSimpleJsonFilter(@NotNull
                                             SimpleJsonWriter writer)

      Constructor.
      Parameters:
        `writer` - writer to which this filter writes.

  - ### 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`