Package javax.json

Interface JsonObjectBuilder


public interface JsonObjectBuilder
A JsonObjectBuilder can be used to build JsonObjects. Instances are not thread safe. Calling any of those methods with either the name or value param as null will result in a NullPointerException
  • Method Details

    • add

      JsonObjectBuilder add(String name, JsonValue value)
      Add the given JsonValue value to the JsonObject to be created. If a value with that name already exists it will be replaced by the new value.
      Parameters:
      name - the JSON attribute name
      value - the JsonValue to add
      Returns:
      the current JsonObjectBuilder
    • add

      JsonObjectBuilder add(String name, String value)
      Add the given String value to the JsonObject to be created. If a value with that name already exists it will be replaced by the new value.
      Parameters:
      name - the JSON attribute name
      value - the String value to add
      Returns:
      the current JsonObjectBuilder
    • add

      JsonObjectBuilder add(String name, BigInteger value)
      Add the given BigInteger value to the JsonObject to be created. If a value with that name already exists it will be replaced by the new value.
      Parameters:
      name - the JSON attribute name
      value - the BigInteger value to add
      Returns:
      the current JsonObjectBuilder
    • add

      JsonObjectBuilder add(String name, BigDecimal value)
      Add the given BigDecimal value to the JsonObject to be created. If a value with that name already exists it will be replaced by the new value.
      Parameters:
      name - the JSON attribute name
      value - the BigDecimal value to add
      Returns:
      the current JsonObjectBuilder
    • add

      JsonObjectBuilder add(String name, int value)
      Add the given int value to the JsonObject to be created. If a value with that name already exists it will be replaced by the new value.
      Parameters:
      name - the JSON attribute name
      value - to add
      Returns:
      the current JsonObjectBuilder
    • add

      JsonObjectBuilder add(String name, long value)
      Add the given long value to the JsonObject to be created. If a value with that name already exists it will be replaced by the new value.
      Parameters:
      name - the JSON attribute name
      value - to add
      Returns:
      the current JsonObjectBuilder
    • add

      JsonObjectBuilder add(String name, double value)
      Add the given double value to the JsonObject to be created. If a value with that name already exists it will be replaced by the new value.
      Parameters:
      name - the JSON attribute name
      value - to add
      Returns:
      the current JsonObjectBuilder
    • add

      JsonObjectBuilder add(String name, boolean value)
      Add the given boolean value to the JsonObject to be created. If a value with that name already exists it will be replaced by the new value.
      Parameters:
      name - the JSON attribute name
      value - to add
      Returns:
      the current JsonObjectBuilder
    • addNull

      JsonObjectBuilder addNull(String name)
      Add a JsonValue.NULL value to the JsonObject to be created. If a value with that name already exists it will be replaced by the null value.
      Parameters:
      name - the JSON attribute name
      Returns:
      the current JsonObjectBuilder
    • add

      Use the given JsonObjectBuilder to create a JsonObject which will be added to the JsonObject to be created by this builder. If a value with that name already exists it will be replaced by the new value.
      Parameters:
      name - the JSON attribute name
      builder - for creating the JsonObject to add
      Returns:
      the current JsonObjectBuilder
    • add

      Use the given JsonArrayBuilder to create a JsonArray which will be added to the JsonObject to be created by this builder. If a value with that name already exists it will be replaced by the new value.
      Parameters:
      name - the JSON attribute name
      builder - for creating the JsonArray to add
      Returns:
      the current JsonObjectBuilder
    • build

      JsonObject build()
      Returns:
      a JsonObject based on the added values.
    • addAll

      default JsonObjectBuilder addAll(JsonObjectBuilder builder)
      Add all of the attributes of the given JsonObjectBuilder to the current one
      Since:
      1.1
    • remove

      default JsonObjectBuilder remove(String name)
      Remove the attribute with the given name from the builder.
      Since:
      1.1