Class JsonbObjectBuilder

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

public class JsonbObjectBuilder extends Object
A builder for creating Jsonb object. This class initializes a Jsonb object and provides methods to add name/value pairs to the object and to return the resulting object. The methods in this class can be chained to add multiple name/value pairs to the object.
  • Constructor Details

    • JsonbObjectBuilder

      public JsonbObjectBuilder()
      Initializes a Jsonb object.
  • Method Details

    • add

      public JsonbObjectBuilder add(String name, String value)
      Adds a name/string pair to the Jsonb object associated with this object builder. If the object contains a mapping for the specified name, this method replaces the old value with the specified value.
      Parameters:
      name - name in the name/value pair
      value - value in the name/value pair
      Returns:
      this object builder
    • add

      public JsonbObjectBuilder add(String name, long value)
      Adds a name/long pair to the Jsonb object associated with this object builder. If the object contains a mapping for the specified name, this method replaces the old value with the specified value.
      Parameters:
      name - name in the name/value pair
      value - value in the name/value pair
      Returns:
      this object builder
    • add

      public JsonbObjectBuilder add(String name, double value)
      Adds a name/double pair to the Jsonb object associated with this object builder. If the object contains a mapping for the specified name, this method replaces the old value with the specified value.
      Parameters:
      name - name in the name/value pair
      value - value in the name/value pair
      Returns:
      this object builder
    • add

      public JsonbObjectBuilder add(String name, boolean value)
      Adds a name/boolean pair to the Jsonb object associated with this object builder. If the object contains a mapping for the specified name, this method replaces the old value with the specified value.
      Parameters:
      name - name in the name/value pair
      value - value in the name/value pair
      Returns:
      this object builder
    • addNull

      public JsonbObjectBuilder addNull(String name)
      Adds a name/null pair to the Jsonb object associated with this object builder where the value is null. If the object contains a mapping for the specified name, this method replaces the old value with null.
      Parameters:
      name - name in the name/value pair
      Returns:
      this object builder
    • add

      public JsonbObjectBuilder add(String name, Jsonb j)
      Adds a name/Jsonb pair to the Jsonb object associated with this object builder. If the object contains a mapping for the specified name, this method replaces the old value with the Jsonb.
      Parameters:
      name - name in the name/value pair
      j - the value is the object associated with Jsonb
      Returns:
      this object builder
    • add

      public JsonbObjectBuilder add(String name, Object value)
      Adds a name/object pair to the Jsonb object associated with this object builder. If the object contains a mapping for the specified name, this method replaces the old value with the object.
      Parameters:
      name - name in the name/value pair
      value - the value is the object
      Returns:
      this object builder
    • add

      public JsonbObjectBuilder add(String name, JsonbArrayBuilder builder)
      Adds a name/JsonbArray pair to the Jsonb object associated with this object builder. If the object contains a mapping for the specified name, this method replaces the old value with JsonbArray.
      Parameters:
      name - name in the name/value pair
      builder - the value is the object array with this builder
      Returns:
      this object builder
    • add

      public JsonbObjectBuilder add(String name, JsonbObjectBuilder builder)
      Adds a name/JsonbObject pair to the Jsonb object associated with this object builder. If the object contains a mapping for the specified name, this method replaces the old value with JsonbObject.
      Parameters:
      name - name in the name/value pair
      builder - the value is the object associated with this builder
      Returns:
      this object builder
    • build

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