Package de.pangaea.metadataportal.utils

## Class KeyValuePairs

- java.lang.Object
- - de.pangaea.metadataportal.utils.KeyValuePairs

-     public final class KeyValuePairs
      extends Object

  Key/Value pairs used to build JSON. This behaves like a `Map` where you can add element, but duplicate elements make the values an array. It also supports adding `KeyValuePairs` as value, in which case an object is created in the resulting JSON.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `KeyValuePairs()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `add​(String key, Object value)` |
    `void` | `add​(String key, Object... values)` |
    `boolean` | `isEmpty()` |
    `void` | `serializeToContentBuilder​(org.elasticsearch.common.xcontent.XContentBuilder builder)` | Serializes the object to a sequence of fields.
    `int` | `size()` |
    `String` | `toString()`

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

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

- - ### Constructor Detail

    - #### KeyValuePairs

          public KeyValuePairs()

  - ### Method Detail

    - #### add

          public void add​(String key,
                          Object value)

    - #### add

          public void add​(String key,
                          Object... values)

    - #### size

          public int size()

    - #### isEmpty

          public boolean isEmpty()

    - #### serializeToContentBuilder

          public void serializeToContentBuilder​(org.elasticsearch.common.xcontent.XContentBuilder builder)
                                         throws IOException

      Serializes the object to a sequence of fields. The empty object will be serialized as `null`.
      Throws:
        `IOException`

    - #### toString

          public String toString()

      This should be used for debugging only!

      Overrides:
        `toString` in class `Object`