Class JsonObject.Builder
java.lang.Object
io.helidon.json.JsonObject.Builder
- All Implemented Interfaces:
Builder<JsonObject.Builder, JsonObject>, Supplier<JsonObject>
- Enclosing class:
JsonObject
public static final class JsonObject.Builder
extends Object
implements Builder<JsonObject.Builder, JsonObject>
Builder for creating JsonObject instances with a fluent API.
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the JsonObject from the current builder state.from(JsonObject object) Copies all properties from the provided object into this builder.Sets a boolean value for the specified key.Sets a byte value for the specified key.Sets a double value for the specified key.Sets a float value for the specified key.Sets an int value for the specified key.Sets a long value for the specified key.Sets a short value for the specified key.Sets a JsonValue for the specified key.Sets a string value for the specified key.set(String key, BigDecimal value) Sets a BigDecimal value for the specified key.set(String key, BigInteger value) Sets a BigInteger value for the specified key.set(String key, Consumer<JsonObject.Builder> consumer) Sets a nested JsonObject for the specified key using a consumer.setBooleans(String key, List<Boolean> value) Sets a list of booleans for the specified key.setDoubles(String key, List<Double> value) Sets a list of doubles for the specified key.Sets a list of longs for the specified key.Sets a null value for the specified key.setNumbers(String key, List<BigDecimal> value) Sets a list of BigDecimal instances for the specified key.setStrings(String key, List<String> value) Sets a list of strings for the specified key.Sets a list of JsonValue instances for the specified key.Removes the property with the specified key from this builder.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Builder
get, identity, updateModifier and TypeMethodDescriptiondefault JsonObjectget()default JsonObject.Builderidentity()Instance of this builder as the correct type.default JsonObject.Builderupdate(Consumer<JsonObject.Builder> consumer) Update the builder in a fluent API way.
-
Method Details
-
build
Builds the JsonObject from the current builder state.- Specified by:
buildin interfaceBuilder<JsonObject.Builder, JsonObject>- Returns:
- a new JsonObject instance
-
from
Copies all properties from the provided object into this builder.- Parameters:
object- the object to copy values from- Returns:
- this builder for method chaining
-
unset
Removes the property with the specified key from this builder.- Parameters:
key- the key to remove- Returns:
- this builder for method chaining
-
setNull
Sets a null value for the specified key.- Parameters:
key- the key to set- Returns:
- this builder for method chaining
-
set
Sets a JsonValue for the specified key.- Parameters:
key- the key to setvalue- the JsonValue to set- Returns:
- this builder for method chaining
-
set
Sets a nested JsonObject for the specified key using a consumer.- Parameters:
key- the key to setconsumer- the consumer that configures the nested builder- Returns:
- this builder for method chaining
-
set
Sets a string value for the specified key.- Parameters:
key- the key to setvalue- the string value to set- Returns:
- this builder for method chaining
-
set
Sets a boolean value for the specified key.- Parameters:
key- the key to setvalue- the boolean value to set- Returns:
- this builder for method chaining
-
set
Sets a float value for the specified key.- Parameters:
key- the key to setvalue- the float value to set- Returns:
- this builder for method chaining
-
set
Sets a double value for the specified key.- Parameters:
key- the key to setvalue- the double value to set- Returns:
- this builder for method chaining
-
set
Sets a byte value for the specified key.- Parameters:
key- the key to setvalue- the byte value to set- Returns:
- this builder for method chaining
-
set
Sets a short value for the specified key.- Parameters:
key- the key to setvalue- the short value to set- Returns:
- this builder for method chaining
-
set
Sets an int value for the specified key.- Parameters:
key- the key to setvalue- the int value to set- Returns:
- this builder for method chaining
-
set
Sets a long value for the specified key.- Parameters:
key- the key to setvalue- the long value to set- Returns:
- this builder for method chaining
-
set
Sets a BigInteger value for the specified key.- Parameters:
key- the key to setvalue- the BigInteger value to set- Returns:
- this builder for method chaining
-
set
Sets a BigDecimal value for the specified key.- Parameters:
key- the key to setvalue- the BigDecimal value to set- Returns:
- this builder for method chaining
-
setValues
Sets a list of JsonValue instances for the specified key.- Parameters:
key- the key to setvalue- the list of JsonValue instances- Returns:
- this builder for method chaining
-
setStrings
Sets a list of strings for the specified key.- Parameters:
key- the key to setvalue- the list of strings- Returns:
- this builder for method chaining
-
setLongs
Sets a list of longs for the specified key.- Parameters:
key- the key to setvalue- the list of longs- Returns:
- this builder for method chaining
-
setDoubles
Sets a list of doubles for the specified key.- Parameters:
key- the key to setvalue- the list of doubles- Returns:
- this builder for method chaining
-
setNumbers
Sets a list of BigDecimal instances for the specified key.- Parameters:
key- the key to setvalue- the list of BigDecimal instances- Returns:
- this builder for method chaining
-
setBooleans
Sets a list of booleans for the specified key.- Parameters:
key- the key to setvalue- the list of booleans- Returns:
- this builder for method chaining
-