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.Sets a boolean 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 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, 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.
-
Method Details
-
build
Builds the JsonObject from the current builder state.- Specified by:
buildin interfaceBuilder<JsonObject.Builder,JsonObject> - Returns:
- a new JsonObject instance
-
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 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 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
-