Package io.kjson
Class JSONObject.Builder
-
- All Implemented Interfaces:
public final class JSONObject.Builder extends AbstractBuilder<JSONObject.Property>
JSONObject builder class.
-
-
Constructor Summary
Constructors Constructor Description JSONObject.Builder(Integer size, Function1<JSONObject.Builder, Unit> block)
-
Method Summary
Modifier and Type Method Description final BooleancontainsKey(String name)Test whether an entry with the nominated key (name) already exists in the builder. final Unitadd(JSONObject.Property property)Add a Property. final Unitadd(String name, JSONValue value)Add a JSONValue with the specified name. final Unitadd(String name, String value)Add a JSONString with the supplied value and name. final Unitadd(String name, Integer value)Add a JSONInt with the supplied value and name. final Unitadd(String name, Long value)Add a JSONLong with the supplied value and name. final Unitadd(String name, BigDecimal value)Add a JSONDecimal with the supplied value and name. final Unitadd(String name, Boolean value)Add a JSONBoolean with the supplied value and name. final Unitremove(String name)Remove and entry with the specified name. final JSONValueget(String name)Get an existing entry with the specified name. JSONObjectbuild()Build a JSONObject with the entries added. -
-
Constructor Detail
-
JSONObject.Builder
JSONObject.Builder(Integer size, Function1<JSONObject.Builder, Unit> block)
-
-
Method Detail
-
containsKey
final Boolean containsKey(String name)
Test whether an entry with the nominated key (name) already exists in the builder.
-
add
final Unit add(JSONObject.Property property)
Add a Property.
-
add
final Unit add(String name, String value)
Add a JSONString with the supplied value and name.
-
add
final Unit add(String name, BigDecimal value)
Add a JSONDecimal with the supplied value and name.
-
add
final Unit add(String name, Boolean value)
Add a JSONBoolean with the supplied value and name.
-
build
JSONObject build()
Build a JSONObject with the entries added.
-
-
-
-