Class DocumentArray
- java.lang.Object
- 
- com.inductiveautomation.ignition.common.document.DocumentElement
- 
- com.inductiveautomation.ignition.common.document.DocumentArray
 
 
- 
- All Implemented Interfaces:
- java.io.Serializable,- java.lang.Iterable<DocumentElement>
 
 public final class DocumentArray extends DocumentElement implements java.lang.Iterable<DocumentElement> A class representing an array type in Json. An array is a list ofDocumentElements each of which can be of a different type. This is an ordered list, meaning that the order in which elements are added is preserved.- See Also:
- Serialized Form
 
- 
- 
Constructor SummaryConstructors Constructor Description DocumentArray()Creates an empty DocumentArray.DocumentArray(int capacity)DocumentArray(com.inductiveautomation.ignition.common.gson.JsonArray json)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(DocumentElement element)Adds the specified element to self.voidadd(java.lang.Boolean bool)Adds the specified boolean to self.voidadd(java.lang.Character character)Adds the specified character to self.voidadd(java.lang.Number number)Adds the specified number to self.voidadd(java.lang.String string)Adds the specified string to self.voidaddAll(DocumentArray array)Adds all the elements of the specified array to self.booleancontains(DocumentElement element)Returns true if this array contains the specified element.DocumentArraydeepCopy()Creates a deep copy of this element and all its childrenbooleanequals(java.lang.Object o)DocumentElementget(int i)Returns the ith element of the array.java.math.BigDecimalgetAsBigDecimal()convenience method to get this array as aBigDecimalif it contains a single element.java.math.BigIntegergetAsBigInteger()convenience method to get this array as aBigIntegerif it contains a single element.booleangetAsBoolean()convenience method to get this array as a boolean if it contains a single element.bytegetAsByte()convenience method to get this element as a primitive byte value.chargetAsCharacter()convenience method to get this element as a primitive character value.doublegetAsDouble()convenience method to get this array as a double if it contains a single element.floatgetAsFloat()convenience method to get this array as a float if it contains a single element.intgetAsInt()convenience method to get this array as an integer if it contains a single element.longgetAsLong()convenience method to get this array as a long if it contains a single element.java.lang.NumbergetAsNumber()convenience method to get this array as aNumberif it contains a single element.shortgetAsShort()convenience method to get this array as a primitive short if it contains a single element.java.lang.StringgetAsString()convenience method to get this array as aStringif it contains a single element.inthashCode()java.util.Iterator<DocumentElement>iterator()Returns an iterator to navigate the elements of the array.DocumentElementremove(int index)Removes the element at the specified position in this array.booleanremove(DocumentElement element)Removes the first occurrence of the specified element from this array, if it is present.DocumentElementset(int index, DocumentElement element)Replaces the element at the specified position in this array with the specified element.intsize()Returns the number of elements in the array.com.inductiveautomation.ignition.common.gson.JsonArraytoJsonElement()- 
Methods inherited from class com.inductiveautomation.ignition.common.document.DocumentElementfromJson, getAsDocument, getAsDocumentArray, getAsDocumentNull, getAsDocumentPrimitive, isDocument, isDocumentArray, isDocumentNull, isDocumentPrimitive, toString
 
- 
 
- 
- 
- 
Method Detail- 
deepCopypublic DocumentArray deepCopy() Creates a deep copy of this element and all its children- Specified by:
- deepCopyin class- DocumentElement
 
 - 
toJsonElementpublic com.inductiveautomation.ignition.common.gson.JsonArray toJsonElement() - Specified by:
- toJsonElementin class- DocumentElement
 
 - 
addpublic void add(java.lang.Boolean bool) Adds the specified boolean to self.- Parameters:
- bool- the boolean that needs to be added to the array.
 
 - 
addpublic void add(java.lang.Character character) Adds the specified character to self.- Parameters:
- character- the character that needs to be added to the array.
 
 - 
addpublic void add(java.lang.Number number) Adds the specified number to self.- Parameters:
- number- the number that needs to be added to the array.
 
 - 
addpublic void add(java.lang.String string) Adds the specified string to self.- Parameters:
- string- the string that needs to be added to the array.
 
 - 
addpublic void add(DocumentElement element) Adds the specified element to self.- Parameters:
- element- the element that needs to be added to the array.
 
 - 
addAllpublic void addAll(DocumentArray array) Adds all the elements of the specified array to self.- Parameters:
- array- the array whose elements need to be added to the array.
 
 - 
setpublic DocumentElement set(int index, DocumentElement element) Replaces the element at the specified position in this array with the specified element. Element can be null.- Parameters:
- index- index of the element to replace
- element- element to be stored at the specified position
- Returns:
- the element previously at the specified position
- Throws:
- java.lang.IndexOutOfBoundsException- if the specified index is outside the array bounds
 
 - 
removepublic boolean remove(DocumentElement element) Removes the first occurrence of the specified element from this array, if it is present. If the array does not contain the element, it is unchanged.- Parameters:
- element- element to be removed from this array, if present
- Returns:
- true if this array contained the specified element, false otherwise
 
 - 
removepublic DocumentElement remove(int index) Removes the element at the specified position in this array. Shifts any subsequent elements to the left (subtracts one from their indices). Returns the element that was removed from the array.- Parameters:
- index- index the index of the element to be removed
- Returns:
- the element previously at the specified position
- Throws:
- java.lang.IndexOutOfBoundsException- if the specified index is outside the array bounds
 
 - 
containspublic boolean contains(DocumentElement element) Returns true if this array contains the specified element.- Parameters:
- element- whose presence in this array is to be tested
- Returns:
- true if this array contains the specified element.
 
 - 
sizepublic int size() Returns the number of elements in the array.- Returns:
- the number of elements in the array.
 
 - 
iteratorpublic java.util.Iterator<DocumentElement> iterator() Returns an iterator to navigate the elements of the array. Since the array is an ordered list, the iterator navigates the elements in the order they were inserted.- Specified by:
- iteratorin interface- java.lang.Iterable<DocumentElement>
- Returns:
- an iterator to navigate the elements of the array.
 
 - 
getpublic DocumentElement get(int i) Returns the ith element of the array.- Parameters:
- i- the index of the element that is being sought.
- Returns:
- the element present at the ith index.
- Throws:
- java.lang.IndexOutOfBoundsException- if i is negative or greater than or equal to the- size()of the array.
 
 - 
getAsNumberpublic java.lang.Number getAsNumber() convenience method to get this array as aNumberif it contains a single element.- Overrides:
- getAsNumberin class- DocumentElement
- Returns:
- get this element as a number if it is single element array.
- Throws:
- java.lang.ClassCastException- if the element in the array is of not a- DocumentPrimitiveand is not a valid Number.
- java.lang.IllegalStateException- if the array has more than one element.
 
 - 
getAsStringpublic java.lang.String getAsString() convenience method to get this array as aStringif it contains a single element.- Overrides:
- getAsStringin class- DocumentElement
- Returns:
- get this element as a String if it is single element array.
- Throws:
- java.lang.ClassCastException- if the element in the array is of not a- DocumentPrimitiveand is not a valid String.
- java.lang.IllegalStateException- if the array has more than one element.
 
 - 
getAsDoublepublic double getAsDouble() convenience method to get this array as a double if it contains a single element.- Overrides:
- getAsDoublein class- DocumentElement
- Returns:
- get this element as a double if it is single element array.
- Throws:
- java.lang.ClassCastException- if the element in the array is of not a- DocumentPrimitiveand is not a valid double.
- java.lang.IllegalStateException- if the array has more than one element.
 
 - 
getAsBigDecimalpublic java.math.BigDecimal getAsBigDecimal() convenience method to get this array as aBigDecimalif it contains a single element.- Overrides:
- getAsBigDecimalin class- DocumentElement
- Returns:
- get this element as a BigDecimalif it is single element array.
- Throws:
- java.lang.ClassCastException- if the element in the array is of not a- DocumentPrimitive.
- java.lang.NumberFormatException- if the element at index 0 is not a valid- BigDecimal.
- java.lang.IllegalStateException- if the array has more than one element.
 
 - 
getAsBigIntegerpublic java.math.BigInteger getAsBigInteger() convenience method to get this array as aBigIntegerif it contains a single element.- Overrides:
- getAsBigIntegerin class- DocumentElement
- Returns:
- get this element as a BigIntegerif it is single element array.
- Throws:
- java.lang.ClassCastException- if the element in the array is of not a- DocumentPrimitive.
- java.lang.NumberFormatException- if the element at index 0 is not a valid- BigInteger.
- java.lang.IllegalStateException- if the array has more than one element.
 
 - 
getAsFloatpublic float getAsFloat() convenience method to get this array as a float if it contains a single element.- Overrides:
- getAsFloatin class- DocumentElement
- Returns:
- get this element as a float if it is single element array.
- Throws:
- java.lang.ClassCastException- if the element in the array is of not a- DocumentPrimitiveand is not a valid float.
- java.lang.IllegalStateException- if the array has more than one element.
 
 - 
getAsLongpublic long getAsLong() convenience method to get this array as a long if it contains a single element.- Overrides:
- getAsLongin class- DocumentElement
- Returns:
- get this element as a long if it is single element array.
- Throws:
- java.lang.ClassCastException- if the element in the array is of not a- DocumentPrimitiveand is not a valid long.
- java.lang.IllegalStateException- if the array has more than one element.
 
 - 
getAsIntpublic int getAsInt() convenience method to get this array as an integer if it contains a single element.- Overrides:
- getAsIntin class- DocumentElement
- Returns:
- get this element as an integer if it is single element array.
- Throws:
- java.lang.ClassCastException- if the element in the array is of not a- DocumentPrimitiveand is not a valid integer.
- java.lang.IllegalStateException- if the array has more than one element.
 
 - 
getAsBytepublic byte getAsByte() Description copied from class:DocumentElementconvenience method to get this element as a primitive byte value.- Overrides:
- getAsBytein class- DocumentElement
- Returns:
- get this element as a primitive byte value.
 
 - 
getAsCharacterpublic char getAsCharacter() Description copied from class:DocumentElementconvenience method to get this element as a primitive character value.- Overrides:
- getAsCharacterin class- DocumentElement
- Returns:
- get this element as a primitive char value.
 
 - 
getAsShortpublic short getAsShort() convenience method to get this array as a primitive short if it contains a single element.- Overrides:
- getAsShortin class- DocumentElement
- Returns:
- get this element as a primitive short if it is single element array.
- Throws:
- java.lang.ClassCastException- if the element in the array is of not a- DocumentPrimitiveand is not a valid short.
- java.lang.IllegalStateException- if the array has more than one element.
 
 - 
getAsBooleanpublic boolean getAsBoolean() convenience method to get this array as a boolean if it contains a single element.- Overrides:
- getAsBooleanin class- DocumentElement
- Returns:
- get this element as a boolean if it is single element array.
- Throws:
- java.lang.ClassCastException- if the element in the array is of not a- DocumentPrimitiveand is not a valid boolean.
- java.lang.IllegalStateException- if the array has more than one element.
 
 - 
equalspublic boolean equals(java.lang.Object o) - Overrides:
- equalsin class- java.lang.Object
 
 - 
hashCodepublic int hashCode() - Overrides:
- hashCodein class- java.lang.Object
 
 
- 
 
-