Package org.glassfish.json
Class JsonArrayBuilderImpl
java.lang.Object
org.glassfish.json.JsonArrayBuilderImpl
- All Implemented Interfaces:
JsonArrayBuilder
JsonArrayBuilder implementation
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionJsonArrayBuilderImpl
(Collection<?> collection, BufferPool bufferPool) JsonArrayBuilderImpl
(JsonArray array, BufferPool bufferPool) JsonArrayBuilderImpl
(BufferPool bufferPool) -
Method Summary
Modifier and TypeMethodDescriptionadd
(boolean value) Adds aJsonValue.TRUE
orJsonValue.FALSE
value to the array.add
(double value) Adds a value to the array as aJsonNumber
.add
(int value) Adds a value to the array as aJsonNumber
.add
(int index, boolean value) Adds aJsonValue.TRUE
orJsonValue.FALSE
value to the array at the specified position.add
(int index, double value) Adds a value to the array as aJsonNumber
at the specified position.add
(int index, int value) Adds a value to the array as aJsonNumber
at the specified position.add
(int index, long value) Adds a value to the array as aJsonNumber
at the specified position.Adds a value to the array as aJsonString
at the specified position.add
(int index, BigDecimal value) Adds a value to the array as aJsonNumber
at the specified position.add
(int index, BigInteger value) Adds a value to the array as aJsonNumber
at the specified position.add
(int index, JsonArrayBuilder builder) Adds aJsonArray
from an array builder to the array at the specified position.add
(int index, JsonObjectBuilder builder) Adds aJsonObject
from an object builder to the array at the specified position.Inserts a value to the array at the specified position.add
(long value) Adds a value to the array as aJsonNumber
.Adds a value to the array as aJsonString
.add
(BigDecimal value) Adds a value to the array as aJsonNumber
.add
(BigInteger value) Adds a value to the array as aJsonNumber
.add
(JsonArrayBuilder builder) Adds aJsonArray
from an array builder to the array.add
(JsonObjectBuilder builder) Adds aJsonObject
from an object builder to the array.Adds a value to the array.addAll
(JsonArrayBuilder builder) Adds all elements of the array in the specified array builder to the array.addNull()
Adds aJsonValue.NULL
value to the array.addNull
(int index) Adds aJsonValue.NULL
value to the array at the specified position.private void
addValueList
(int index, JsonValue value) private void
addValueList
(JsonValue value) build()
Returns the current array.private void
populate
(Collection<?> collection) remove
(int index) Remove the value in the array at the specified position.set
(int index, boolean value) Replaces a value in the array with aJsonValue.TRUE
orJsonValue.FALSE
value at the specified position.set
(int index, double value) Replaces a value in the array with the specified value as aJsonNumber
at the specified position.set
(int index, int value) Replaces a value in the array with the specified value as aJsonNumber
at the specified position.set
(int index, long value) Replaces a value in the array with the specified value as aJsonNumber
at the specified position.Replaces a value in the array with the specified value as aJsonString
at the specified position.set
(int index, BigDecimal value) Replaces a value in the array with the specified value as aJsonNumber
at the specified position.set
(int index, BigInteger value) Replaces a value in the array with the specified value as aJsonNumber
at the specified position.set
(int index, JsonArrayBuilder builder) Replaces a value in the array with the specified value as aJsonArray
from an array builder at the specified position.set
(int index, JsonObjectBuilder builder) Replaces a value in the array with the specified value as aJsonObject
from an object builder at the specified position.Replaces a value in the array with the specified value at the specified position.setNull
(int index) Replaces a value in the array with aJsonValue.NULL
value at the specified position.private void
setValueList
(int index, JsonValue value) private void
validateValue
(Object value)
-
Field Details
-
valueList
-
bufferPool
-
-
Constructor Details
-
JsonArrayBuilderImpl
JsonArrayBuilderImpl(BufferPool bufferPool) -
JsonArrayBuilderImpl
JsonArrayBuilderImpl(JsonArray array, BufferPool bufferPool) -
JsonArrayBuilderImpl
JsonArrayBuilderImpl(Collection<?> collection, BufferPool bufferPool)
-
-
Method Details
-
add
Description copied from interface:JsonArrayBuilder
Adds a value to the array.- Specified by:
add
in interfaceJsonArrayBuilder
- Parameters:
value
- the JSON value- Returns:
- this array builder
-
add
Description copied from interface:JsonArrayBuilder
Adds a value to the array as aJsonString
.- Specified by:
add
in interfaceJsonArrayBuilder
- Parameters:
value
- the string value- Returns:
- this array builder
-
add
Description copied from interface:JsonArrayBuilder
Adds a value to the array as aJsonNumber
.- Specified by:
add
in interfaceJsonArrayBuilder
- Parameters:
value
- the number value- Returns:
- this array builder
- See Also:
-
add
Description copied from interface:JsonArrayBuilder
Adds a value to the array as aJsonNumber
.- Specified by:
add
in interfaceJsonArrayBuilder
- Parameters:
value
- the number value- Returns:
- this array builder
- See Also:
-
add
Description copied from interface:JsonArrayBuilder
Adds a value to the array as aJsonNumber
.- Specified by:
add
in interfaceJsonArrayBuilder
- Parameters:
value
- the number value- Returns:
- this array builder
- See Also:
-
add
Description copied from interface:JsonArrayBuilder
Adds a value to the array as aJsonNumber
.- Specified by:
add
in interfaceJsonArrayBuilder
- Parameters:
value
- the number value- Returns:
- this array builder
- See Also:
-
add
Description copied from interface:JsonArrayBuilder
Adds a value to the array as aJsonNumber
.- Specified by:
add
in interfaceJsonArrayBuilder
- Parameters:
value
- the number value- Returns:
- this array builder
- See Also:
-
add
Description copied from interface:JsonArrayBuilder
Adds aJsonValue.TRUE
orJsonValue.FALSE
value to the array.- Specified by:
add
in interfaceJsonArrayBuilder
- Parameters:
value
- the boolean value- Returns:
- this array builder
-
addNull
Description copied from interface:JsonArrayBuilder
Adds aJsonValue.NULL
value to the array.- Specified by:
addNull
in interfaceJsonArrayBuilder
- Returns:
- this array builder
-
add
Description copied from interface:JsonArrayBuilder
Adds aJsonObject
from an object builder to the array.- Specified by:
add
in interfaceJsonArrayBuilder
- Parameters:
builder
- the object builder- Returns:
- this array builder
-
add
Description copied from interface:JsonArrayBuilder
Adds aJsonArray
from an array builder to the array.- Specified by:
add
in interfaceJsonArrayBuilder
- Parameters:
builder
- the array builder- Returns:
- this array builder
-
addAll
Description copied from interface:JsonArrayBuilder
Adds all elements of the array in the specified array builder to the array.- Specified by:
addAll
in interfaceJsonArrayBuilder
- Parameters:
builder
- the array builder- Returns:
- this array builder
-
add
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 interfaceJsonArrayBuilder
- Parameters:
index
- the position in the arrayvalue
- the JSON value- Returns:
- this array builder
-
add
Description copied from interface:JsonArrayBuilder
Adds a value to the array as aJsonString
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 interfaceJsonArrayBuilder
- Parameters:
index
- the position in the arrayvalue
- the string value- Returns:
- this array builder
-
add
Description copied from interface:JsonArrayBuilder
Adds a value to the array as aJsonNumber
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 interfaceJsonArrayBuilder
- Parameters:
index
- the position in the arrayvalue
- the number value- Returns:
- this array builder
- See Also:
-
add
Description copied from interface:JsonArrayBuilder
Adds a value to the array as aJsonNumber
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 interfaceJsonArrayBuilder
- Parameters:
index
- the position in the arrayvalue
- the number value- Returns:
- this array builder
- See Also:
-
add
Description copied from interface:JsonArrayBuilder
Adds a value to the array as aJsonNumber
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 interfaceJsonArrayBuilder
- Parameters:
index
- the position in the arrayvalue
- the number value- Returns:
- this array builder
- See Also:
-
add
Description copied from interface:JsonArrayBuilder
Adds a value to the array as aJsonNumber
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 interfaceJsonArrayBuilder
- Parameters:
index
- the position in the arrayvalue
- the number value- Returns:
- this array builder
- See Also:
-
add
Description copied from interface:JsonArrayBuilder
Adds a value to the array as aJsonNumber
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 interfaceJsonArrayBuilder
- Parameters:
index
- the position in the arrayvalue
- the number value- Returns:
- this array builder
- See Also:
-
add
Description copied from interface:JsonArrayBuilder
Adds aJsonValue.TRUE
orJsonValue.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 interfaceJsonArrayBuilder
- Parameters:
index
- the position in the arrayvalue
- the boolean value- Returns:
- this array builder
-
addNull
Description copied from interface:JsonArrayBuilder
Adds aJsonValue.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 interfaceJsonArrayBuilder
- Parameters:
index
- the position in the array- Returns:
- this array builder
-
add
Description copied from interface:JsonArrayBuilder
Adds aJsonObject
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 interfaceJsonArrayBuilder
- Parameters:
index
- the position in the arraybuilder
- the object builder- Returns:
- this array builder
-
add
Description copied from interface:JsonArrayBuilder
Adds aJsonArray
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 interfaceJsonArrayBuilder
- Parameters:
index
- the position in the arraybuilder
- the array builder- Returns:
- this array builder
-
set
Description copied from interface:JsonArrayBuilder
Replaces a value in the array with the specified value at the specified position.- Specified by:
set
in interfaceJsonArrayBuilder
- Parameters:
index
- the position in the arrayvalue
- the JSON value- Returns:
- this array builder
-
set
Description copied from interface:JsonArrayBuilder
Replaces a value in the array with the specified value as aJsonString
at the specified position.- Specified by:
set
in interfaceJsonArrayBuilder
- Parameters:
index
- the position in the arrayvalue
- the string value- Returns:
- this array builder
-
set
Description copied from interface:JsonArrayBuilder
Replaces a value in the array with the specified value as aJsonNumber
at the specified position.- Specified by:
set
in interfaceJsonArrayBuilder
- Parameters:
index
- the position in the arrayvalue
- the number value- Returns:
- this array builder
- See Also:
-
set
Description copied from interface:JsonArrayBuilder
Replaces a value in the array with the specified value as aJsonNumber
at the specified position.- Specified by:
set
in interfaceJsonArrayBuilder
- Parameters:
index
- the position in the arrayvalue
- the number value- Returns:
- this array builder
- See Also:
-
set
Description copied from interface:JsonArrayBuilder
Replaces a value in the array with the specified value as aJsonNumber
at the specified position.- Specified by:
set
in interfaceJsonArrayBuilder
- Parameters:
index
- the position in the arrayvalue
- the number value- Returns:
- this array builder
- See Also:
-
set
Description copied from interface:JsonArrayBuilder
Replaces a value in the array with the specified value as aJsonNumber
at the specified position.- Specified by:
set
in interfaceJsonArrayBuilder
- Parameters:
index
- the position in the arrayvalue
- the number value- Returns:
- this array builder
- See Also:
-
set
Description copied from interface:JsonArrayBuilder
Replaces a value in the array with the specified value as aJsonNumber
at the specified position.- Specified by:
set
in interfaceJsonArrayBuilder
- Parameters:
index
- the position in the arrayvalue
- the number value- Returns:
- this array builder
- See Also:
-
set
Description copied from interface:JsonArrayBuilder
Replaces a value in the array with aJsonValue.TRUE
orJsonValue.FALSE
value at the specified position.- Specified by:
set
in interfaceJsonArrayBuilder
- Parameters:
index
- the position in the arrayvalue
- the boolean value- Returns:
- this array builder
-
setNull
Description copied from interface:JsonArrayBuilder
Replaces a value in the array with aJsonValue.NULL
value at the specified position.- Specified by:
setNull
in interfaceJsonArrayBuilder
- Parameters:
index
- the position in the array- Returns:
- this array builder
-
set
Description copied from interface:JsonArrayBuilder
Replaces a value in the array with the specified value as aJsonObject
from an object builder at the specified position.- Specified by:
set
in interfaceJsonArrayBuilder
- Parameters:
index
- the position in the arraybuilder
- the object builder- Returns:
- this array builder
-
set
Description copied from interface:JsonArrayBuilder
Replaces a value in the array with the specified value as aJsonArray
from an array builder at the specified position.- Specified by:
set
in interfaceJsonArrayBuilder
- Parameters:
index
- the position in the arraybuilder
- the array builder- Returns:
- this array builder
-
remove
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 interfaceJsonArrayBuilder
- Parameters:
index
- the position in the array- Returns:
- this array builder
-
build
Description copied from interface:JsonArrayBuilder
Returns the current array.- Specified by:
build
in interfaceJsonArrayBuilder
- Returns:
- the current JSON array
-
populate
-
addValueList
-
addValueList
-
setValueList
-
validateValue
-