Class JsonbArrayBuilder

java.lang.Object
net.bitnine.agensgraph.util.JsonbArrayBuilder

public class JsonbArrayBuilder extends Object
A builder for creating Jsonb array. This class initializes a Jsonb array and provides methods to add values to the array and to return the resulting array. The methods in this class can be chained to add multiple values to the array.
  • Constructor Details

    • JsonbArrayBuilder

      public JsonbArrayBuilder()
      Initializes a Jsonb array.
  • Method Details

    • add

      public JsonbArrayBuilder add(String value)
      Adds a value to the array as a string.
      Parameters:
      value - the string value
      Returns:
      this array builder
    • add

      public JsonbArrayBuilder add(long value)
      Adds a value to the array as a long.
      Parameters:
      value - the long value
      Returns:
      this array builder
    • add

      public JsonbArrayBuilder add(double value)
      Adds a value to the array as a double.
      Parameters:
      value - the double value
      Returns:
      this array builder
    • add

      public JsonbArrayBuilder add(boolean value)
      Adds a value to the array as a boolean.
      Parameters:
      value - the boolean value
      Returns:
      this array builder
    • addNull

      public JsonbArrayBuilder addNull()
      Adds a value to the array as a null.
      Returns:
      this array builder
    • add

      public JsonbArrayBuilder add(Jsonb j)
      Adds a value to the array as a Jsonb.
      Parameters:
      j - the Jsonb value
      Returns:
      this array builder
    • add

      public JsonbArrayBuilder add(Object value)
      Adds a value to the array as an object.
      Parameters:
      value - the object value
      Returns:
      this array builder
    • add

      public JsonbArrayBuilder add(JsonbArrayBuilder builder)
      Adds a JsonbArray from an array builder to the array.
      Parameters:
      builder - the array builder
      Returns:
      this array builder
    • add

      public JsonbArrayBuilder add(JsonbObjectBuilder builder)
      Adds a JsonbObject from an array builder to the array.
      Parameters:
      builder - the object builder
      Returns:
      this array builder
    • build

      public Jsonb build()
      Returns the Jsonb array associated with this array builder.
      Returns:
      the Jsonb array that is being built