class JsonObjectBuilderImpl extends java.lang.Object implements JsonObjectBuilder
| Modifier and Type | Class and Description |
|---|---|
private static class |
JsonObjectBuilderImpl.JsonObjectImpl |
| Modifier and Type | Field and Description |
|---|---|
private BufferPool |
bufferPool |
private java.util.Map<java.lang.String,JsonValue> |
valueMap |
| Constructor and Description |
|---|
JsonObjectBuilderImpl(BufferPool bufferPool) |
| Modifier and Type | Method and Description |
|---|---|
JsonObjectBuilder |
add(java.lang.String name,
java.math.BigDecimal value)
Adds a name/
JsonNumber pair to the JSON object associated with
this object builder. |
JsonObjectBuilder |
add(java.lang.String name,
java.math.BigInteger value)
Adds a name/
JsonNumber pair to the JSON object associated with
this object builder. |
JsonObjectBuilder |
add(java.lang.String name,
boolean value)
Adds a name/
JsonValue#TRUE or name/JsonValue#FALSE pair
to the JSON object associated with this object builder. |
JsonObjectBuilder |
add(java.lang.String name,
double value)
Adds a name/
JsonNumber pair to the JSON object associated with
this object builder. |
JsonObjectBuilder |
add(java.lang.String name,
int value)
Adds a name/
JsonNumber pair to the JSON object associated with
this object builder. |
JsonObjectBuilder |
add(java.lang.String name,
JsonArrayBuilder builder)
Adds a name/
JsonArray pair to the JSON object associated with
this object builder. |
JsonObjectBuilder |
add(java.lang.String name,
JsonObjectBuilder builder)
Adds a name/
JsonObject pair to the JSON object associated
with this object builder. |
JsonObjectBuilder |
add(java.lang.String name,
JsonValue value)
Adds a name/
JsonValue pair to the JSON object associated with
this object builder. |
JsonObjectBuilder |
add(java.lang.String name,
long value)
Adds a name/
JsonNumber pair to the JSON object associated with
this object builder. |
JsonObjectBuilder |
add(java.lang.String name,
java.lang.String value)
Adds a name/
JsonString pair to the JSON object associated with
this object builder. |
JsonObjectBuilder |
addNull(java.lang.String name)
Adds a name/
JsonValue#NULL pair to the JSON object associated
with this object builder where the value is null. |
JsonObject |
build()
Returns the JSON object associated with this object builder.
|
private void |
putValueMap(java.lang.String name,
JsonValue value) |
private void |
validateName(java.lang.String name) |
private void |
validateValue(java.lang.Object value) |
private java.util.Map<java.lang.String,JsonValue> valueMap
private final BufferPool bufferPool
JsonObjectBuilderImpl(BufferPool bufferPool)
public JsonObjectBuilder add(java.lang.String name, JsonValue value)
JsonObjectBuilderJsonValue 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.add in interface JsonObjectBuildername - name in the name/value pairvalue - value in the name/value pairpublic JsonObjectBuilder add(java.lang.String name, java.lang.String value)
JsonObjectBuilderJsonString 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.add in interface JsonObjectBuildername - name in the name/value pairvalue - value in the name/value pairpublic JsonObjectBuilder add(java.lang.String name, java.math.BigInteger value)
JsonObjectBuilderJsonNumber 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.add in interface JsonObjectBuildername - name in the name/value pairvalue - value in the name/value pairJsonNumberpublic JsonObjectBuilder add(java.lang.String name, java.math.BigDecimal value)
JsonObjectBuilderJsonNumber 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.add in interface JsonObjectBuildername - name in the name/value pairvalue - value in the name/value pairJsonNumberpublic JsonObjectBuilder add(java.lang.String name, int value)
JsonObjectBuilderJsonNumber 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.add in interface JsonObjectBuildername - name in the name/value pairvalue - value in the name/value pairJsonNumberpublic JsonObjectBuilder add(java.lang.String name, long value)
JsonObjectBuilderJsonNumber 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.add in interface JsonObjectBuildername - name in the name/value pairvalue - value in the name/value pairJsonNumberpublic JsonObjectBuilder add(java.lang.String name, double value)
JsonObjectBuilderJsonNumber 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.add in interface JsonObjectBuildername - name in the name/value pairvalue - value in the name/value pairJsonNumberpublic JsonObjectBuilder add(java.lang.String name, boolean value)
JsonObjectBuilderJsonValue#TRUE or name/JsonValue#FALSE 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.add in interface JsonObjectBuildername - name in the name/value pairvalue - value in the name/value pairpublic JsonObjectBuilder addNull(java.lang.String name)
JsonObjectBuilderJsonValue#NULL pair to the JSON object associated
with this object builder where the value is null.
If the object contains a mapping for the specified name, this method
replaces the old value with null.addNull in interface JsonObjectBuildername - name in the name/value pairpublic JsonObjectBuilder add(java.lang.String name, JsonObjectBuilder builder)
JsonObjectBuilderJsonObject pair to the JSON object associated
with this object builder. The value JsonObject is built from the
specified object builder. If the object contains a mapping for the
specified name, this method replaces the old value with the
JsonObject from the specified object builder.add in interface JsonObjectBuildername - name in the name/value pairbuilder - the value is the object associated with this builderpublic JsonObjectBuilder add(java.lang.String name, JsonArrayBuilder builder)
JsonObjectBuilderJsonArray pair to the JSON object associated with
this object builder. The value JsonArray is built from the
specified array builder. If the object contains a mapping for the
specified name, this method replaces the old value with the
JsonArray from the specified array builder.add in interface JsonObjectBuildername - the name in the name/value pairbuilder - the value is the object array with this builderpublic JsonObject build()
JsonObjectBuilderJsonObject is based
on the order in which name/value pairs are added to the object using
this builder.build in interface JsonObjectBuilderprivate void putValueMap(java.lang.String name,
JsonValue value)
private void validateName(java.lang.String name)
private void validateValue(java.lang.Object value)