public class JsonArray extends JsonElement
Constructor and Description |
---|
JsonArray()
Constructs a JsonArray to be used in constructing a JSON representation.
|
JsonArray(JsonElement baseElement)
Constructs a JsonArray from an existing JsonElement,
using its parser and event list.
|
JsonArray(javax.json.stream.JsonParser jsonParser,
List<String> eventList)
Constructs a JsonArray.
|
JsonArray(List<AttributeValueTable> avtList)
Constructs a JsonArray from a list of AttributeValueTable.
|
JsonArray(String[] stringVals)
Constructs a JsonArray to represent an array of Strings.
|
Modifier and Type | Method and Description |
---|---|
void |
add(boolean value)
Adds a boolean value.
|
void |
add(double value)
Adds a double value.
|
void |
add(JsonArray value)
Adds a JsonArray value.
|
void |
add(JsonObject value)
Adds a JsonObject value.
|
void |
add(long value)
Adds a long value.
|
void |
add(String value)
Adds a String value.
|
void |
addArray(JsonArray value)
Adds a JsonArray value.
|
void |
addElement(JsonElement value)
Adds a JsonElement.
|
void |
addNull()
Adds a null value.
|
void |
addObject(JsonObject value)
Adds a JsonObject value.
|
void |
addTable(AttributeValueTable avt)
Adds a value from the specified AttributeValueTable.
|
void |
addTableList(List<AttributeValueTable> avtList)
Adds values from the specified list of AttributeValueTable.
|
void |
addToTable(AttributeValueTable avt,
String key)
Add this JsonArray to the specified AttributeValueTable.
|
void |
addValue(AttributeValue av)
Adds a String, number, or boolean value (as an AttributeValue).
|
List<JsonArray> |
getArrayList()
Gets the object depiction as a list of JsonArray.
|
Boolean[] |
getBooleanValueArray()
Gets the value as an array of Boolean, if this
object depicts a homogeneous set of Booleans.
|
Double[] |
getDoubleValueArray()
Gets the value as an array of Double, if this
object depicts a homogeneous set of Doubles.
|
List<Object> |
getElementList()
Gets the object depiction as a list of Object, used for cases where the
elements of the array are not homogeneous.
|
Long[] |
getLongValueArray()
Gets the value as an array of Long, if this
object depicts a homogeneous set of Longs.
|
List<JsonObject> |
getObjectList()
Gets the object depiction as a list of JsonObject.
|
String[] |
getStringValueArray()
Gets the value as an array of String, if this
object depicts a homogeneous set of Strings.
|
List<AttributeValue> |
getValueList()
Gets the object depiction as a list of AttributeValue.
|
boolean |
isArrayList()
Checks if this object depicts a list of JsonArray.
|
boolean |
isBooleanValueList()
Checks if this object depicts a list of Boolean AttributeValues.
|
boolean |
isDoubleValueList()
Checks if this object depicts a list of Double AttributeValues.
|
boolean |
isLongValueList()
Checks if this object depicts a list of Long AttributeValues.
|
boolean |
isNullArray()
Checks if this object depicts a null array
(legal in JSON).
|
boolean |
isObjectList()
Checks if this object depicts a list of JsonObject.
|
boolean |
isStringValueList()
Checks if this object depicts a list of String AttributeValues.
|
boolean |
isValueList()
Checks if this object depicts a list of AttributeValue.
|
void |
parseArray()
Parses the array.
|
List<AttributeValueTable> |
toAttributeValueTableList()
Convert this object to a list of AttributeValueTable.
|
String |
toString()
Convert this object to JSON format.
|
contructBooleanValue, contructDoubleValue, contructLongValue, contructLongValue, contructStringValue, getJsonEventStringList, getJsonParser, getNextEvent, getValueAsJsonValue
public JsonArray()
public JsonArray(javax.json.stream.JsonParser jsonParser, List<String> eventList)
jsonParser
- the JSON parser being used to create this objecteventList
- the event string listpublic JsonArray(List<AttributeValueTable> avtList) throws IfsException
avtList
- the list of AttributeValueTableIfsException
public JsonArray(JsonElement baseElement)
baseElement
- the JsonElement which holds the
parser and event listpublic JsonArray(String[] stringVals)
stringVals
- the String values comprising the arraypublic String[] getStringValueArray() throws IfsException
isStringValueList()
returns false)IfsException
- if this operation failspublic Boolean[] getBooleanValueArray() throws IfsException
isBooleanValueList()
returns false)IfsException
- if this operation failspublic Long[] getLongValueArray() throws IfsException
isLongValueList()
returns false)IfsException
- if this operation failspublic Double[] getDoubleValueArray() throws IfsException
isDoubleValueList()
returns false)IfsException
- if this operation failspublic List<AttributeValue> getValueList()
isValueList()
returns false)public List<JsonObject> getObjectList()
isObjectList()
returns false)public List<JsonArray> getArrayList()
isArrayList()
returns false)public List<Object> getElementList()
public boolean isStringValueList()
public boolean isBooleanValueList()
public boolean isLongValueList()
public boolean isDoubleValueList()
public boolean isValueList()
public boolean isObjectList()
public boolean isArrayList()
public boolean isNullArray()
public void add(String value)
value
- the String valuepublic void add(long value)
value
- the long valuepublic void add(double value)
value
- the double valuepublic void add(boolean value)
value
- the boolean valuepublic void add(JsonObject value)
value
- the JsonObject valuepublic void add(JsonArray value)
value
- the JsonArray valuepublic void addNull()
public void addTable(AttributeValueTable avt)
avt
- the AttributeValueTablepublic void addTableList(List<AttributeValueTable> avtList)
avtList
- the list of AttributeValueTablespublic void addValue(AttributeValue av)
av
- the AttributeValuepublic void addObject(JsonObject value)
value
- the JsonObject valuepublic void addArray(JsonArray value)
value
- the JsonArray valuepublic void addElement(JsonElement value)
value
- the JsonElement valuepublic String toString()
public List<AttributeValueTable> toAttributeValueTableList() throws IfsException
IfsException
- if this operation failspublic void addToTable(AttributeValueTable avt, String key) throws IfsException
avt
- the AttributeValueTablekey
- the key to use for the valueIfsException
- if this operation failspublic void parseArray()
Copyright © 2023. All rights reserved.