javax.json
Interface JsonArrayBuilder<T>


public interface JsonArrayBuilder<T>

Helps in building a JSON array. This is an intermediary class and the actual build process is started from JsonBuilder or JsonGenerator

Author:
Jitendra Kotamraju
See Also:
JsonBuilder, JsonGenerator

Method Summary
 JsonArrayBuilder<T> add(BigDecimal value)
          Adds the specified value as a JSON number value to the array that is being built.
 JsonArrayBuilder<T> add(BigInteger value)
          Adds the specified value as a JSON number value to the array that is being built.
 JsonArrayBuilder<T> add(boolean value)
          Adds a JSON true or false value to the array that is being built.
 JsonArrayBuilder<T> add(double value)
          Adds the specified value as a JSON number value to the array that is being built.
 JsonArrayBuilder<T> add(int value)
          Adds the specified value as a JSON number value to the array that is being built.
 JsonArrayBuilder<T> add(JsonValue value)
          Adds the specified value to the array that is being built.
 JsonArrayBuilder<T> add(long value)
          Adds the specified value as a JSON number value to the array that is being built.
 JsonArrayBuilder<T> add(String value)
          Adds the specified value as a JSON string value to the array that is being built.
 JsonArrayBuilder<T> addNull()
          Adds the JSON null value to the array that is being built.
 JsonArrayBuilder<JsonArrayBuilder<T>> beginArray()
          Returns a JSON array builder to build a new array value
 JsonObjectBuilder<JsonArrayBuilder<T>> beginObject()
          Returns a JSON array builder to build a new object value
 T endArray()
          Indicates the end of the JSON array that is being built.
 

Method Detail

endArray

T endArray()
Indicates the end of the JSON array that is being built.

Returns:
the enclosing object of type T
Throws:
IllegalStateException - when endArray method is already called.

add

JsonArrayBuilder<T> add(JsonValue value)
Adds the specified value to the array that is being built.

Parameters:
value -
Returns:
this array builder
Throws:
IllegalStateException - when invoked after endArray method is called.

add

JsonArrayBuilder<T> add(String value)
Adds the specified value as a JSON string value to the array that is being built.

Parameters:
value - string
Returns:
this array builder
Throws:
IllegalStateException - when invoked after endArray method is called.

add

JsonArrayBuilder<T> add(BigDecimal value)
Adds the specified value as a JSON number value to the array that is being built.

Parameters:
value - a number
Returns:
this array builder
Throws:
IllegalStateException - when invoked after endArray method is called.
See Also:
JsonNumber

add

JsonArrayBuilder<T> add(BigInteger value)
Adds the specified value as a JSON number value to the array that is being built.

Parameters:
value - a number
Returns:
this array builder
Throws:
IllegalStateException - when invoked after endArray method is called.
See Also:
JsonNumber

add

JsonArrayBuilder<T> add(int value)
Adds the specified value as a JSON number value to the array that is being built.

Parameters:
value - a number
Returns:
this array builder
Throws:
IllegalStateException - when invoked after endArray method is called.
See Also:
JsonNumber

add

JsonArrayBuilder<T> add(long value)
Adds the specified value as a JSON number value to the array that is being built.

Parameters:
value - a number
Returns:
this array builder
Throws:
IllegalStateException - when invoked after endArray method is called.
See Also:
JsonNumber

add

JsonArrayBuilder<T> add(double value)
Adds the specified value as a JSON number value to the array that is being built.

Parameters:
value - a number
Returns:
this array builder
Throws:
IllegalStateException - when invoked after endArray method is called.
NumberFormatException - if value is Not-a-Number(NaN) or infinity
See Also:
JsonNumber

add

JsonArrayBuilder<T> add(boolean value)
Adds a JSON true or false value to the array that is being built.

TODO not needed since add(JsonValue.TRUE|FALSE) can be used ??

Parameters:
value - a boolean
Returns:
this array builder
Throws:
IllegalStateException - when invoked after endArray method is called.

addNull

JsonArrayBuilder<T> addNull()
Adds the JSON null value to the array that is being built.

TODO not needed since add(JsonValue.NULL) can be used ??

Returns:
this array builder
Throws:
IllegalStateException - when invoked after endArray method is called.

beginObject

JsonObjectBuilder<JsonArrayBuilder<T>> beginObject()
Returns a JSON array builder to build a new object value

Returns:
an array builder
Throws:
IllegalStateException - when invoked after endArray method is called.

beginArray

JsonArrayBuilder<JsonArrayBuilder<T>> beginArray()
Returns a JSON array builder to build a new array value

Returns:
an array builder
Throws:
IllegalStateException - when invoked after endArray method is called.



Copyright © 2012 Oracle and/or its affiliates. All rights reserved.