Class JsonArrayBuilderImpl

java.lang.Object
org.glassfish.json.JsonArrayBuilderImpl
All Implemented Interfaces:
JsonArrayBuilder

class JsonArrayBuilderImpl extends Object implements JsonArrayBuilder
JsonArrayBuilder implementation
  • Field Details

  • Constructor Details

  • Method Details

    • add

      public JsonArrayBuilder add(JsonValue value)
      Description copied from interface: JsonArrayBuilder
      Adds a value to the array.
      Specified by:
      add in interface JsonArrayBuilder
      Parameters:
      value - the JSON value
      Returns:
      this array builder
    • add

      public JsonArrayBuilder add(String value)
      Description copied from interface: JsonArrayBuilder
      Adds a value to the array as a JsonString.
      Specified by:
      add in interface JsonArrayBuilder
      Parameters:
      value - the string value
      Returns:
      this array builder
    • add

      public JsonArrayBuilder add(BigDecimal value)
      Description copied from interface: JsonArrayBuilder
      Adds a value to the array as a JsonNumber.
      Specified by:
      add in interface JsonArrayBuilder
      Parameters:
      value - the number value
      Returns:
      this array builder
      See Also:
    • add

      public JsonArrayBuilder add(BigInteger value)
      Description copied from interface: JsonArrayBuilder
      Adds a value to the array as a JsonNumber.
      Specified by:
      add in interface JsonArrayBuilder
      Parameters:
      value - the number value
      Returns:
      this array builder
      See Also:
    • add

      public JsonArrayBuilder add(int value)
      Description copied from interface: JsonArrayBuilder
      Adds a value to the array as a JsonNumber.
      Specified by:
      add in interface JsonArrayBuilder
      Parameters:
      value - the number value
      Returns:
      this array builder
      See Also:
    • add

      public JsonArrayBuilder add(long value)
      Description copied from interface: JsonArrayBuilder
      Adds a value to the array as a JsonNumber.
      Specified by:
      add in interface JsonArrayBuilder
      Parameters:
      value - the number value
      Returns:
      this array builder
      See Also:
    • add

      public JsonArrayBuilder add(double value)
      Description copied from interface: JsonArrayBuilder
      Adds a value to the array as a JsonNumber.
      Specified by:
      add in interface JsonArrayBuilder
      Parameters:
      value - the number value
      Returns:
      this array builder
      See Also:
    • add

      public JsonArrayBuilder add(boolean value)
      Description copied from interface: JsonArrayBuilder
      Adds a JsonValue.TRUE or JsonValue.FALSE value to the array.
      Specified by:
      add in interface JsonArrayBuilder
      Parameters:
      value - the boolean value
      Returns:
      this array builder
    • addNull

      public JsonArrayBuilder addNull()
      Description copied from interface: JsonArrayBuilder
      Adds a JsonValue.NULL value to the array.
      Specified by:
      addNull in interface JsonArrayBuilder
      Returns:
      this array builder
    • add

      public JsonArrayBuilder add(JsonObjectBuilder builder)
      Description copied from interface: JsonArrayBuilder
      Adds a JsonObject from an object builder to the array.
      Specified by:
      add in interface JsonArrayBuilder
      Parameters:
      builder - the object builder
      Returns:
      this array builder
    • add

      public JsonArrayBuilder add(JsonArrayBuilder builder)
      Description copied from interface: JsonArrayBuilder
      Adds a JsonArray from an array builder to the array.
      Specified by:
      add in interface JsonArrayBuilder
      Parameters:
      builder - the array builder
      Returns:
      this array builder
    • addAll

      public JsonArrayBuilder addAll(JsonArrayBuilder builder)
      Description copied from interface: JsonArrayBuilder
      Adds all elements of the array in the specified array builder to the array.
      Specified by:
      addAll in interface JsonArrayBuilder
      Parameters:
      builder - the array builder
      Returns:
      this array builder
    • add

      public JsonArrayBuilder add(int index, JsonValue value)
      Description copied from interface: JsonArrayBuilder
      Inserts a value to the array at the specified position. Shifts the value currently at that position (if any) and any subsequent values to the right (adds one to their indices). Index starts with 0.
      Specified by:
      add in interface JsonArrayBuilder
      Parameters:
      index - the position in the array
      value - the JSON value
      Returns:
      this array builder
    • add

      public JsonArrayBuilder add(int index, String value)
      Description copied from interface: JsonArrayBuilder
      Adds a value to the array as a JsonString at the specified position. Shifts the value currently at that position (if any) and any subsequent values to the right (adds one to their indices). Index starts with 0.
      Specified by:
      add in interface JsonArrayBuilder
      Parameters:
      index - the position in the array
      value - the string value
      Returns:
      this array builder
    • add

      public JsonArrayBuilder add(int index, BigDecimal value)
      Description copied from interface: JsonArrayBuilder
      Adds a value to the array as a JsonNumber at the specified position. Shifts the value currently at that position (if any) and any subsequent values to the right (adds one to their indices). Index starts with 0.
      Specified by:
      add in interface JsonArrayBuilder
      Parameters:
      index - the position in the array
      value - the number value
      Returns:
      this array builder
      See Also:
    • add

      public JsonArrayBuilder add(int index, BigInteger value)
      Description copied from interface: JsonArrayBuilder
      Adds a value to the array as a JsonNumber at the specified position. Shifts the value currently at that position (if any) and any subsequent values to the right (adds one to their indices). Index starts with 0.
      Specified by:
      add in interface JsonArrayBuilder
      Parameters:
      index - the position in the array
      value - the number value
      Returns:
      this array builder
      See Also:
    • add

      public JsonArrayBuilder add(int index, int value)
      Description copied from interface: JsonArrayBuilder
      Adds a value to the array as a JsonNumber at the specified position. Shifts the value currently at that position (if any) and any subsequent values to the right (adds one to their indices). Index starts with 0.
      Specified by:
      add in interface JsonArrayBuilder
      Parameters:
      index - the position in the array
      value - the number value
      Returns:
      this array builder
      See Also:
    • add

      public JsonArrayBuilder add(int index, long value)
      Description copied from interface: JsonArrayBuilder
      Adds a value to the array as a JsonNumber at the specified position. Shifts the value currently at that position (if any) and any subsequent values to the right (adds one to their indices). Index starts with 0.
      Specified by:
      add in interface JsonArrayBuilder
      Parameters:
      index - the position in the array
      value - the number value
      Returns:
      this array builder
      See Also:
    • add

      public JsonArrayBuilder add(int index, double value)
      Description copied from interface: JsonArrayBuilder
      Adds a value to the array as a JsonNumber at the specified position. Shifts the value currently at that position (if any) and any subsequent values to the right (adds one to their indices). Index starts with 0.
      Specified by:
      add in interface JsonArrayBuilder
      Parameters:
      index - the position in the array
      value - the number value
      Returns:
      this array builder
      See Also:
    • add

      public JsonArrayBuilder add(int index, boolean value)
      Description copied from interface: JsonArrayBuilder
      Adds a JsonValue.TRUE or JsonValue.FALSE value to the array at the specified position. Shifts the value currently at that position (if any) and any subsequent values to the right (adds one to their indices). Index starts with 0.
      Specified by:
      add in interface JsonArrayBuilder
      Parameters:
      index - the position in the array
      value - the boolean value
      Returns:
      this array builder
    • addNull

      public JsonArrayBuilder addNull(int index)
      Description copied from interface: JsonArrayBuilder
      Adds a JsonValue.NULL value to the array at the specified position. Shifts the value currently at that position (if any) and any subsequent values to the right (adds one to their indices). Index starts with 0.
      Specified by:
      addNull in interface JsonArrayBuilder
      Parameters:
      index - the position in the array
      Returns:
      this array builder
    • add

      public JsonArrayBuilder add(int index, JsonObjectBuilder builder)
      Description copied from interface: JsonArrayBuilder
      Adds a JsonObject from an object builder to the array at the specified position. Shifts the value currently at that position (if any) and any subsequent values to the right (adds one to their indices). Index starts with 0.
      Specified by:
      add in interface JsonArrayBuilder
      Parameters:
      index - the position in the array
      builder - the object builder
      Returns:
      this array builder
    • add

      public JsonArrayBuilder add(int index, JsonArrayBuilder builder)
      Description copied from interface: JsonArrayBuilder
      Adds a JsonArray from an array builder to the array at the specified position. Shifts the value currently at that position (if any) and any subsequent values to the right (adds one to their indices). Index starts with 0.
      Specified by:
      add in interface JsonArrayBuilder
      Parameters:
      index - the position in the array
      builder - the array builder
      Returns:
      this array builder
    • set

      public JsonArrayBuilder set(int index, JsonValue value)
      Description copied from interface: JsonArrayBuilder
      Replaces a value in the array with the specified value at the specified position.
      Specified by:
      set in interface JsonArrayBuilder
      Parameters:
      index - the position in the array
      value - the JSON value
      Returns:
      this array builder
    • set

      public JsonArrayBuilder set(int index, String value)
      Description copied from interface: JsonArrayBuilder
      Replaces a value in the array with the specified value as a JsonString at the specified position.
      Specified by:
      set in interface JsonArrayBuilder
      Parameters:
      index - the position in the array
      value - the string value
      Returns:
      this array builder
    • set

      public JsonArrayBuilder set(int index, BigDecimal value)
      Description copied from interface: JsonArrayBuilder
      Replaces a value in the array with the specified value as a JsonNumber at the specified position.
      Specified by:
      set in interface JsonArrayBuilder
      Parameters:
      index - the position in the array
      value - the number value
      Returns:
      this array builder
      See Also:
    • set

      public JsonArrayBuilder set(int index, BigInteger value)
      Description copied from interface: JsonArrayBuilder
      Replaces a value in the array with the specified value as a JsonNumber at the specified position.
      Specified by:
      set in interface JsonArrayBuilder
      Parameters:
      index - the position in the array
      value - the number value
      Returns:
      this array builder
      See Also:
    • set

      public JsonArrayBuilder set(int index, int value)
      Description copied from interface: JsonArrayBuilder
      Replaces a value in the array with the specified value as a JsonNumber at the specified position.
      Specified by:
      set in interface JsonArrayBuilder
      Parameters:
      index - the position in the array
      value - the number value
      Returns:
      this array builder
      See Also:
    • set

      public JsonArrayBuilder set(int index, long value)
      Description copied from interface: JsonArrayBuilder
      Replaces a value in the array with the specified value as a JsonNumber at the specified position.
      Specified by:
      set in interface JsonArrayBuilder
      Parameters:
      index - the position in the array
      value - the number value
      Returns:
      this array builder
      See Also:
    • set

      public JsonArrayBuilder set(int index, double value)
      Description copied from interface: JsonArrayBuilder
      Replaces a value in the array with the specified value as a JsonNumber at the specified position.
      Specified by:
      set in interface JsonArrayBuilder
      Parameters:
      index - the position in the array
      value - the number value
      Returns:
      this array builder
      See Also:
    • set

      public JsonArrayBuilder set(int index, boolean value)
      Description copied from interface: JsonArrayBuilder
      Replaces a value in the array with a JsonValue.TRUE or JsonValue.FALSE value at the specified position.
      Specified by:
      set in interface JsonArrayBuilder
      Parameters:
      index - the position in the array
      value - the boolean value
      Returns:
      this array builder
    • setNull

      public JsonArrayBuilder setNull(int index)
      Description copied from interface: JsonArrayBuilder
      Replaces a value in the array with a JsonValue.NULL value at the specified position.
      Specified by:
      setNull in interface JsonArrayBuilder
      Parameters:
      index - the position in the array
      Returns:
      this array builder
    • set

      public JsonArrayBuilder set(int index, JsonObjectBuilder builder)
      Description copied from interface: JsonArrayBuilder
      Replaces a value in the array with the specified value as a JsonObject from an object builder at the specified position.
      Specified by:
      set in interface JsonArrayBuilder
      Parameters:
      index - the position in the array
      builder - the object builder
      Returns:
      this array builder
    • set

      public JsonArrayBuilder set(int index, JsonArrayBuilder builder)
      Description copied from interface: JsonArrayBuilder
      Replaces a value in the array with the specified value as a JsonArray from an array builder at the specified position.
      Specified by:
      set in interface JsonArrayBuilder
      Parameters:
      index - the position in the array
      builder - the array builder
      Returns:
      this array builder
    • remove

      public JsonArrayBuilder remove(int index)
      Description copied from interface: JsonArrayBuilder
      Remove the value in the array at the specified position. Shift any subsequent values to the left (subtracts one from their indices.
      Specified by:
      remove in interface JsonArrayBuilder
      Parameters:
      index - the position in the array
      Returns:
      this array builder
    • build

      public JsonArray build()
      Description copied from interface: JsonArrayBuilder
      Returns the current array.
      Specified by:
      build in interface JsonArrayBuilder
      Returns:
      the current JSON array
    • populate

      private void populate(Collection<?> collection)
    • addValueList

      private void addValueList(JsonValue value)
    • addValueList

      private void addValueList(int index, JsonValue value)
    • setValueList

      private void setValueList(int index, JsonValue value)
    • validateValue

      private void validateValue(Object value)