Interface JSONObject.Builder
-
- All Superinterfaces:
JSONNode.Builder
- Enclosing interface:
- JSONObject
public static interface JSONObject.Builder extends JSONNode.Builder
BuildJSONObject
instances- Author:
- cdivilly
- See Also:
JSONObjects.object()
-
<section role="region">
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description JSONObject.Builder
add(java.lang.String propertyName, java.lang.Boolean value)
Add a boolean JSON propertyJSONObject.Builder
add(java.lang.String propertyName, java.lang.CharSequence value)
Add a String JSON propertyJSONObject.Builder
add(java.lang.String propertyName, java.lang.Number value)
Create a numeric JSON propertyJSONObject.Builder
add(java.lang.String propertyName, java.lang.Object value)
Add a property.JSONObject.Builder
add(java.lang.String propertyName, JSONNode value)
Add a JSON property containing another JSON documentJSONObject.Builder
add(JSONObject existing)
Add all the properties in the existingJSONObject
to this object.JSONObject.Builder
addNull(java.lang.String propertyName)
Add a null propertyJSONObject
build()
Build theJSONNode
instanceJSONObject.Builder
remove(java.lang.String propertyName)
Remove the named property
-
-
<section role="region">
-
Method Detail
-
add
JSONObject.Builder add(JSONObject existing)
Add all the properties in the existingJSONObject
to this object.- Parameters:
existing
- TheJSONObject
containing properties to be added- Returns:
- self
-
add
JSONObject.Builder add(java.lang.String propertyName, java.lang.Object value)
Add a property.- Parameters:
propertyName
- The name of the propertyvalue
- The value to add, must be an instance of one of the types specified here.- Returns:
- self
-
add
JSONObject.Builder add(java.lang.String propertyName, java.lang.Boolean value)
Add a boolean JSON property- Parameters:
propertyName
- property namevalue
- property value- Returns:
- self
-
add
JSONObject.Builder add(java.lang.String propertyName, java.lang.CharSequence value)
Add a String JSON property- Parameters:
propertyName
- property namevalue
- property value- Returns:
- self
-
add
JSONObject.Builder add(java.lang.String propertyName, JSONNode value)
Add a JSON property containing another JSON document- Parameters:
propertyName
- property namevalue
- property value- Returns:
- self
-
add
JSONObject.Builder add(java.lang.String propertyName, java.lang.Number value)
Create a numeric JSON property- Parameters:
propertyName
- property namevalue
- property value- Returns:
- self
-
addNull
JSONObject.Builder addNull(java.lang.String propertyName)
Add a null property- Parameters:
propertyName
- property name- Returns:
- self
-
remove
JSONObject.Builder remove(java.lang.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 theJSONNode
instance- Specified by:
build
in interfaceJSONNode.Builder
- Returns:
JSONNode
instance
-
-