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 Details

    • build

      public JsonObject build()
      Builds the JsonObject from the current builder state.
      Specified by:
      build in interface Builder<JsonObject.Builder,JsonObject>
      Returns:
      a new JsonObject instance
    • unset

      public JsonObject.Builder unset(String key)
      Removes the property with the specified key from this builder.
      Parameters:
      key - the key to remove
      Returns:
      this builder for method chaining
    • setNull

      public JsonObject.Builder setNull(String key)
      Sets a null value for the specified key.
      Parameters:
      key - the key to set
      Returns:
      this builder for method chaining
    • set

      public JsonObject.Builder set(String key, JsonValue value)
      Sets a JsonValue for the specified key.
      Parameters:
      key - the key to set
      value - the JsonValue to set
      Returns:
      this builder for method chaining
    • set

      public JsonObject.Builder set(String key, Consumer<JsonObject.Builder> consumer)
      Sets a nested JsonObject for the specified key using a consumer.
      Parameters:
      key - the key to set
      consumer - the consumer that configures the nested builder
      Returns:
      this builder for method chaining
    • set

      public JsonObject.Builder set(String key, String value)
      Sets a string value for the specified key.
      Parameters:
      key - the key to set
      value - the string value to set
      Returns:
      this builder for method chaining
    • set

      public JsonObject.Builder set(String key, boolean value)
      Sets a boolean value for the specified key.
      Parameters:
      key - the key to set
      value - the boolean value to set
      Returns:
      this builder for method chaining
    • set

      public JsonObject.Builder set(String key, float value)
      Sets a float value for the specified key.
      Parameters:
      key - the key to set
      value - the float value to set
      Returns:
      this builder for method chaining
    • set

      public JsonObject.Builder set(String key, double value)
      Sets a double value for the specified key.
      Parameters:
      key - the key to set
      value - the double value to set
      Returns:
      this builder for method chaining
    • set

      public JsonObject.Builder set(String key, int value)
      Sets an int value for the specified key.
      Parameters:
      key - the key to set
      value - the int value to set
      Returns:
      this builder for method chaining
    • set

      public JsonObject.Builder set(String key, long value)
      Sets a long value for the specified key.
      Parameters:
      key - the key to set
      value - the long value to set
      Returns:
      this builder for method chaining
    • set

      public JsonObject.Builder set(String key, BigDecimal value)
      Sets a BigDecimal value for the specified key.
      Parameters:
      key - the key to set
      value - the BigDecimal value to set
      Returns:
      this builder for method chaining
    • setValues

      public JsonObject.Builder setValues(String key, List<JsonValue> value)
      Sets a list of JsonValue instances for the specified key.
      Parameters:
      key - the key to set
      value - the list of JsonValue instances
      Returns:
      this builder for method chaining
    • setStrings

      public JsonObject.Builder setStrings(String key, List<String> value)
      Sets a list of strings for the specified key.
      Parameters:
      key - the key to set
      value - the list of strings
      Returns:
      this builder for method chaining
    • setLongs

      public JsonObject.Builder setLongs(String key, List<Long> value)
      Sets a list of longs for the specified key.
      Parameters:
      key - the key to set
      value - the list of longs
      Returns:
      this builder for method chaining
    • setDoubles

      public JsonObject.Builder setDoubles(String key, List<Double> value)
      Sets a list of doubles for the specified key.
      Parameters:
      key - the key to set
      value - the list of doubles
      Returns:
      this builder for method chaining
    • setNumbers

      public JsonObject.Builder setNumbers(String key, List<BigDecimal> value)
      Sets a list of BigDecimal instances for the specified key.
      Parameters:
      key - the key to set
      value - the list of BigDecimal instances
      Returns:
      this builder for method chaining
    • setBooleans

      public JsonObject.Builder setBooleans(String key, List<Boolean> value)
      Sets a list of booleans for the specified key.
      Parameters:
      key - the key to set
      value - the list of booleans
      Returns:
      this builder for method chaining