Class MapElementExtractor
java.lang.Object
com.inductiveautomation.ignition.common.expressions.MapElementExtractor
- All Implemented Interfaces:
ElementExtractor<Object>
An
ElementExtractor over plain Java objects: Maps are the map elements, Java
arrays (accessed reflectively) are the array elements, and everything else is a primitive
returned as-is by toJava(java.lang.Object).-
Nested Class Summary
Nested classes/interfaces inherited from interface com.inductiveautomation.ignition.common.expressions.ElementExtractor
ElementExtractor.ElementNotFoundException -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final MapElementExtractorThe stateless, shared instance. -
Method Summary
Modifier and TypeMethodDescriptionint@Nullable ObjectextractIndex(Object element, int index) @Nullable ObjectextractKey(Object element, String key) booleanbooleanbooleanbooleanisPrimitive(@Nullable Object element) mapName()
-
Field Details
-
INSTANCE
The stateless, shared instance.
-
-
Method Details
-
isMap
- Specified by:
isMapin interfaceElementExtractor<Object>- Returns:
- true if
elementis a map: a containerElementExtractor.extractKey(T, java.lang.String)can step into; false for null.
-
extractKey
- Specified by:
extractKeyin interfaceElementExtractor<Object>- Returns:
- the value at
key; null if the key is present with a null value.
-
mapName
- Specified by:
mapNamein interfaceElementExtractor<Object>- Returns:
- the representation's name for its map type (e.g.
"JsonObject"), used in type-mismatch error messages.
-
isArray
- Specified by:
isArrayin interfaceElementExtractor<Object>- Returns:
- true if
elementis an array: a containerElementExtractor.extractIndex(T, int)can step into; false for null.
-
extractIndex
- Specified by:
extractIndexin interfaceElementExtractor<Object>- Returns:
- the value at
index; null if the slot holds a null value.
-
arraySize
- Specified by:
arraySizein interfaceElementExtractor<Object>- Returns:
- the number of elements in
element, for whichElementExtractor.isArray(T)is true.
-
arrayName
- Specified by:
arrayNamein interfaceElementExtractor<Object>- 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<Object>- Returns:
- true if
elementis a Java null or the representation's own null element (e.g.JsonNull).
-
isPrimitive
- Specified by:
isPrimitivein interfaceElementExtractor<Object>- 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<Object>- 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.
-