Class PyDictionaryElementExtractor
java.lang.Object
com.inductiveautomation.ignition.gateway.expressions.PyDictionaryElementExtractor
- All Implemented Interfaces:
ElementExtractor<org.python.core.PyObject>
public class PyDictionaryElementExtractor
extends Object
implements ElementExtractor<org.python.core.PyObject>
An
ElementExtractor over Jython object graphs: PyDictionarys are the map elements
and PySequences are the array elements. Every element is a primitive at the end of a path
— toJava(org.python.core.PyObject) converts any PyObject, containers included, to its plain Java
equivalent.-
Nested Class Summary
Nested classes/interfaces inherited from interface com.inductiveautomation.ignition.common.expressions.ElementExtractor
ElementExtractor.ElementNotFoundException -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PyDictionaryElementExtractorThe stateless, shared instance. -
Method Summary
Modifier and TypeMethodDescriptionintarraySize(org.python.core.PyObject element) org.python.core.PyObjectextractIndex(org.python.core.PyObject element, int index) org.python.core.PyObjectextractKey(org.python.core.PyObject element, String key) booleanisArray(@Nullable org.python.core.PyObject element) booleanisMap(@Nullable org.python.core.PyObject element) booleanisNull(@Nullable org.python.core.PyObject element) booleanisPrimitive(@Nullable org.python.core.PyObject element) mapName()toJava(org.python.core.PyObject element)
-
Field Details
-
INSTANCE
The stateless, shared instance.
-
-
Method Details
-
isMap
public boolean isMap(@Nullable org.python.core.PyObject element) - Specified by:
isMapin interfaceElementExtractor<org.python.core.PyObject>- Returns:
- true if
elementis a map: a containerElementExtractor.extractKey(T, java.lang.String)can step into; false for null.
-
extractKey
- Specified by:
extractKeyin interfaceElementExtractor<org.python.core.PyObject>- Returns:
- the value at
key; null if the key is present with a null value.
-
mapName
- Specified by:
mapNamein interfaceElementExtractor<org.python.core.PyObject>- Returns:
- the representation's name for its map type (e.g.
"JsonObject"), used in type-mismatch error messages.
-
isArray
public boolean isArray(@Nullable org.python.core.PyObject element) - Specified by:
isArrayin interfaceElementExtractor<org.python.core.PyObject>- Returns:
- true if
elementis an array: a containerElementExtractor.extractIndex(T, int)can step into; false for null.
-
extractIndex
public org.python.core.PyObject extractIndex(org.python.core.PyObject element, int index) - Specified by:
extractIndexin interfaceElementExtractor<org.python.core.PyObject>- Returns:
- the value at
index; null if the slot holds a null value.
-
arraySize
public int arraySize(org.python.core.PyObject element) - Specified by:
arraySizein interfaceElementExtractor<org.python.core.PyObject>- Returns:
- the number of elements in
element, for whichElementExtractor.isArray(T)is true.
-
arrayName
- Specified by:
arrayNamein interfaceElementExtractor<org.python.core.PyObject>- Returns:
- the representation's name for its array type (e.g.
"JsonArray"), used in type-mismatch and out-of-bounds error messages.
-
isNull
public boolean isNull(@Nullable org.python.core.PyObject element) - Specified by:
isNullin interfaceElementExtractor<org.python.core.PyObject>- Returns:
- true if
elementis a Java null or the representation's own null element (e.g.JsonNull).
-
isPrimitive
public boolean isPrimitive(@Nullable org.python.core.PyObject element) - Specified by:
isPrimitivein interfaceElementExtractor<org.python.core.PyObject>- 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<org.python.core.PyObject>- 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.
-