Interface JsonObjectBuilder

All Superinterfaces:
Builder<JsonObject>

public interface JsonObjectBuilder extends Builder<JsonObject>
Creates Json objects. Abstracted from JavaEE/glassfisch.
Author:
Holger Eichelberger, SSE
  • Method Details

    • add

      JsonObjectBuilder 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

      JsonObjectBuilder 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

      JsonObjectBuilder 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

      JsonObjectBuilder 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

      JsonObjectBuilder 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

      JsonObjectBuilder 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

      JsonObjectBuilder 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

      JsonObjectBuilder 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

      JsonObjectBuilder 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

      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

      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

      JsonObjectBuilder 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