Interface JSONObject.Builder

All Superinterfaces:
JSONNode.Builder
Enclosing interface:
JSONObject

public static interface JSONObject.Builder extends JSONNode.Builder
Build JSONObject instances
Author:
cdivilly
See Also:
  • Method Details

    • add

      Add all the properties in the existing JSONObject to this object.
      Parameters:
      existing - The JSONObject containing properties to be added
      Returns:
      self
    • add

      JSONObject.Builder add(String propertyName, Object value)
      Add a property.
      Parameters:
      propertyName - The name of the property
      value - The value to add, must be an instance of one of the types specified here.
      Returns:
      self
    • add

      JSONObject.Builder add(String propertyName, Boolean value)
      Add a boolean JSON property
      Parameters:
      propertyName - property name
      value - property value
      Returns:
      self
    • add

      JSONObject.Builder add(String propertyName, CharSequence value)
      Add a String JSON property
      Parameters:
      propertyName - property name
      value - property value
      Returns:
      self
    • add

      JSONObject.Builder add(String propertyName, JSONNode value)
      Add a JSON property containing another JSON document
      Parameters:
      propertyName - property name
      value - property value
      Returns:
      self
    • add

      JSONObject.Builder add(String propertyName, Number value)
      Create a numeric JSON property
      Parameters:
      propertyName - property name
      value - property value
      Returns:
      self
    • addNull

      JSONObject.Builder addNull(String propertyName)
      Add a null property
      Parameters:
      propertyName - property name
      Returns:
      self
    • remove

      JSONObject.Builder remove(String propertyName)
      Remove the named property
      Parameters:
      propertyName - The name of the property to remove
      Returns:
      self
    • build

      JSONObject build()
      Description copied from interface: JSONNode.Builder
      Build the JSONNode instance
      Specified by:
      build in interface JSONNode.Builder
      Returns:
      JSONNode instance