Interface JsonBuilder<T extends JsonBuilder<T>>

Type Parameters:
T - the builder return type

public interface JsonBuilder<T extends JsonBuilder<T>>
Creates Json objects. Abstracted from JavaEE/glassfisch.
Author:
Holger Eichelberger, SSE
  • Method Summary

    Modifier and Type
    Method
    Description
    add(String name, boolean value)
    Adds a name/value pair to the JSON object associated with this object builder.
    add(String name, double value)
    Adds a name/value pair to the JSON object associated with this object builder.
    add(String name, int value)
    Adds a name/value pair to the JSON object associated with this object builder.
    add(String name, JsonArray value)
    Adds a name/value pair to the JSON object associated with this object builder.
    add(String name, JsonArrayBuilder builder)
    Adds a name/value pair to the JSON object associated with this object builder via an array builder.
    add(String name, JsonNumber value)
    Adds a name/value pair to the JSON object associated with this object builder.
    add(String name, JsonObject value)
    Adds a name/value pair to the JSON object associated with this object builder.
    add(String name, JsonObjectBuilder builder)
    Adds a name/value pair to the JSON object associated with this object builder via an object builder.
    add(String name, JsonString value)
    Adds a name/value pair to the JSON object associated with this object builder.
    add(String name, String value)
    Adds a name/value pair to the JSON object associated with this object builder.
    Adds a name/null pair to the JSON object associated with this object builder.
    remove(String name)
    Remove the name/value pair from the JSON object associated with this object builder if it is present.
  • Method Details

    • add

      T add(String name, String value)
      Adds a name/value pair to the JSON object associated with this object builder. If the object contains a mapping for the specified name, this method replaces the old value with the specified value.
      Parameters:
      name - name in the name/value pair
      value - value in the name/value pair
      Returns:
      this for chaining
      Throws:
      NullPointerException - if the specified name is null
    • add

      T add(String name, int value)
      Adds a name/value pair to the JSON object associated with this object builder. If the object contains a mapping for the specified name, this method replaces the old value with the specified value.
      Parameters:
      name - name in the name/value pair
      value - value in the name/value pair
      Returns:
      this for chaining
      Throws:
      NullPointerException - if the specified name is null
    • add

      T add(String name, double value)
      Adds a name/value pair to the JSON object associated with this object builder. If the object contains a mapping for the specified name, this method replaces the old value with the specified value.
      Parameters:
      name - name in the name/value pair
      value - value in the name/value pair
      Returns:
      this for chaining
      Throws:
      NullPointerException - if the specified name is null
    • add

      T add(String name, boolean value)
      Adds a name/value pair to the JSON object associated with this object builder. If the object contains a mapping for the specified name, this method replaces the old value with the specified value.
      Parameters:
      name - name in the name/value pair
      value - value in the name/value pair
      Returns:
      this for chaining
      Throws:
      NullPointerException - if the specified name is null
    • add

      T add(String name, JsonString value)
      Adds a name/value pair to the JSON object associated with this object builder. If the object contains a mapping for the specified name, this method replaces the old value with the specified value.
      Parameters:
      name - name in the name/value pair
      value - value in the name/value pair
      Returns:
      this for chaining
      Throws:
      NullPointerException - if the specified name is null
    • add

      T add(String name, JsonNumber value)
      Adds a name/value pair to the JSON object associated with this object builder. If the object contains a mapping for the specified name, this method replaces the old value with the specified value.
      Parameters:
      name - name in the name/value pair
      value - value in the name/value pair
      Returns:
      this for chaining
      Throws:
      NullPointerException - if the specified name is null
    • add

      T add(String name, JsonArray value)
      Adds a name/value pair to the JSON object associated with this object builder. If the object contains a mapping for the specified name, this method replaces the old value with the specified value.
      Parameters:
      name - name in the name/value pair
      value - value in the name/value pair
      Returns:
      this for chaining
      Throws:
      NullPointerException - if the specified name is null
    • add

      T add(String name, JsonObject value)
      Adds a name/value pair to the JSON object associated with this object builder. If the object contains a mapping for the specified name, this method replaces the old value with the specified value.
      Parameters:
      name - name in the name/value pair
      value - value in the name/value pair
      Returns:
      this for chaining
      Throws:
      NullPointerException - if the specified name is null
    • addNull

      T addNull(String name)
      Adds a name/null pair to the JSON object associated with this object builder. If the object contains a mapping for the specified name, this method replaces the old value with the specified value.
      Parameters:
      name - name in the name/value pair
      Returns:
      this for chaining
      Throws:
      NullPointerException - if the specified name is null
    • add

      T add(String name, JsonArrayBuilder builder)
      Adds a name/value pair to the JSON object associated with this object builder via an array builder. If the object contains a mapping for the specified name, this method replaces the old value with the specified value.
      Parameters:
      name - name in the name/value pair
      builder - the array builder
      Returns:
      this for chaining
      Throws:
      NullPointerException - if the specified name is null
    • add

      T add(String name, JsonObjectBuilder builder)
      Adds a name/value pair to the JSON object associated with this object builder via an object builder. If the object contains a mapping for the specified name, this method replaces the old value with the specified value.
      Parameters:
      name - name in the name/value pair
      builder - the object builder
      Returns:
      this for chaining
      Throws:
      NullPointerException - if the specified name is null
    • remove

      T remove(String name)
      Remove the name/value pair from the JSON object associated with this object builder if it is present.
      Parameters:
      name - the name in the name/value pair to be removed
      Returns:
      this for chaining
      Throws:
      NullPointerException - if the specified name is null