Class DocumentElementExtractor
java.lang.Object
com.inductiveautomation.ignition.common.expressions.DocumentElementExtractor
- All Implemented Interfaces:
ElementExtractor<DocumentElement>
An
ElementExtractor over DocumentElement trees: Documents are the map
elements, DocumentArrays are the array elements, and DocumentPrimitive/
DocumentNull are the primitives, converted to plain Java values by toJava(com.inductiveautomation.ignition.common.document.DocumentElement).-
Nested Class Summary
Nested classes/interfaces inherited from interface com.inductiveautomation.ignition.common.expressions.ElementExtractor
ElementExtractor.ElementNotFoundException -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DocumentElementExtractorThe stateless, shared instance. -
Method Summary
Modifier and TypeMethodDescriptionintarraySize(DocumentElement element) extractIndex(DocumentElement element, int index) extractKey(DocumentElement element, String key) booleanisArray(@Nullable DocumentElement element) booleanisMap(@Nullable DocumentElement element) booleanisNull(@Nullable DocumentElement element) booleanisPrimitive(@Nullable DocumentElement element) mapName()toJava(DocumentElement element)
-
Field Details
-
INSTANCE
The stateless, shared instance.
-
-
Method Details
-
isMap
- Specified by:
isMapin interfaceElementExtractor<DocumentElement>- Returns:
- true if
elementis a map: a containerElementExtractor.extractKey(T, java.lang.String)can step into; false for null.
-
extractKey
- Specified by:
extractKeyin interfaceElementExtractor<DocumentElement>- Returns:
- the value at
key; null if the key is present with a null value.
-
mapName
- Specified by:
mapNamein interfaceElementExtractor<DocumentElement>- Returns:
- the representation's name for its map type (e.g.
"JsonObject"), used in type-mismatch error messages.
-
isArray
- Specified by:
isArrayin interfaceElementExtractor<DocumentElement>- Returns:
- true if
elementis an array: a containerElementExtractor.extractIndex(T, int)can step into; false for null.
-
extractIndex
- Specified by:
extractIndexin interfaceElementExtractor<DocumentElement>- Returns:
- the value at
index; null if the slot holds a null value.
-
arraySize
- Specified by:
arraySizein interfaceElementExtractor<DocumentElement>- Returns:
- the number of elements in
element, for whichElementExtractor.isArray(T)is true.
-
arrayName
- Specified by:
arrayNamein interfaceElementExtractor<DocumentElement>- Returns:
- the representation's name for its array type (e.g.
"JsonArray"), used in type-mismatch and out-of-bounds error messages.
-
isNull
- Specified by:
isNullin interfaceElementExtractor<DocumentElement>- Returns:
- true if
elementis a Java null or the representation's own null element (e.g.JsonNull).
-
isPrimitive
- Specified by:
isPrimitivein interfaceElementExtractor<DocumentElement>- Returns:
- true if
elementis a leaf value —nullor a primitive — thatElementExtractor.toJava(T)converts to a plain Java value; false if it is a map or array, which the evaluator returns in its native representation.
-
toJava
- Specified by:
toJavain interfaceElementExtractor<DocumentElement>- Returns:
- the plain Java equivalent (e.g. String, Long, Double, Boolean) of an element for which
ElementExtractor.isPrimitive(T)is true; null for the representation's null element.
-