Package com.inductiveautomation.rm.base
Class RMKeyChain
java.lang.Object
com.inductiveautomation.rm.base.RMKeyChain
This class evaluates a string expression on a given object: RMKeyChain.getValue(object, expression).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
This is interface is implemented by objects that can get key chain values themselves.static enum
-
Constructor Summary
ConstructorsConstructorDescriptionRMKeyChain
(RMKeyChain.Op anOp) Node constructor.RMKeyChain
(RMKeyChain.Op anOp, Object child) Node constructor.RMKeyChain
(RMKeyChain.Op anOp, Object left, Object right) Node constructor.RMKeyChain
(Object cond, Object tExp, Object fExp) Node constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a child to the end of the keychain's child list.static void
addFunctionClass
(Class aClass) Adds a class to the list of classes that RM queries for functions.boolean
anyKeyReferencesKey
(String aKey) Returns whether given key is used anywhere in expression.static String
Returns the last error encountered by the key chain parser and resets parser.static Map
Returns a thread-local assignments map.static boolean
getBoolValue
(Object anObj, Object aKeyChain) Convenience - returns a boolean for an object and key chain.getChild
(int anIndex) Returns the child at the given index in the keychain.int
Returns the number of children in the keychain.getChildKeyChain
(int i) Returns the child at the given index in the keychain as a keychain.getChildString
(int i) Returns the child at the given index in the keychain as a string.static double
getDoubleValue
(Object anObj, Object aKeyChain) Convenience - returns a double for an object and key chain.static String
getError()
Returns the last error encountered by the key chain parser (or null).static float
getFloatValue
(Object anObj, Object aKeyChain) Convenience - returns a float for an object and key chain.static int
getIntValue
(Object anObj, Object aKeyChain) Convenience - returns an int for an object and key chain.static RMKeyChain
getKeyChain
(Object aSource) Returns a keyChain for aSource (should be a String or existing RMKeyChain).static List
getListValue
(Object anObj, Object aKeyChain) Convenience - returns a list for an object and key chain.static Number
getNumberValue
(Object anObj, Object aKeyChain) Convenience - returns a number for an object and key chain.getOp()
Returns the top level operator of the keychain.static String
getStringValue
(Object anObj, Object aKeyChain) Convenience - returns a string for an object and key chain.getValue()
Returns the value of the keychain.static Object
getValue
(Object anObj, RMKeyChain aKeyChain) Returns the result of evaluating the given key chain on the given object.static Object
Returns the result of evaluating the given key chain on the given object.static Object
getValue
(Object aRoot, Object anObj, RMKeyChain aKeyChain) Returns the result of evaluating the given key chain on the given object.static <T> T
Returns a key value if it is of given class (otherwise null).static Object
getValueImpl
(Object aRoot, Object anObj, RMKeyChain aKeyChain) Returns the result of evaluating the given key chain on the given object.static Object
getValueList
(List aList, RMKeyChain aKeyChain) Returns the result of evaluating the given key chain on the given list.Returns the value of the keychain as a string.boolean
hasOp
(RMKeyChain.Op anOp) Returns whether key contains given op.boolean
Returns whether given key has a Page/PageMax key reference.static void
setEnumValue
(Object anObj, RMKeyChain aKeyChain) Sets the given value for the given key chain + property.static void
setValue
(Object anObj, RMKeyChain aKeyChain, Object aValue) Sets the given value for the given key chain + property.static void
Sets the given value for the given key chain + property.static void
setValueSafe
(Object anObj, String aKey, Object aValue) Sets the value but only prints a warning if it fails.static void
setValueSilent
(Object anObj, String aKey, Object aValue) Tries to set value in given object, ignoring failure exceptions.subchain
(int anIndex) Override to give list chance to implement this.toString()
Returns a string representation of the key chain.
-
Constructor Details
-
RMKeyChain
Node constructor. -
RMKeyChain
Node constructor. -
RMKeyChain
Node constructor. -
RMKeyChain
Node constructor.
-
-
Method Details
-
getKeyChain
Returns a keyChain for aSource (should be a String or existing RMKeyChain). -
getAssignments
Returns a thread-local assignments map. -
getOp
Returns the top level operator of the keychain. -
getValue
Returns the value of the keychain. -
getValueString
Returns the value of the keychain as a string. -
getChildCount
public int getChildCount()Returns the number of children in the keychain. -
getChild
Returns the child at the given index in the keychain. -
addChild
Adds a child to the end of the keychain's child list. -
getChildString
Returns the child at the given index in the keychain as a string. -
getChildKeyChain
Returns the child at the given index in the keychain as a keychain. -
subchain
Override to give list chance to implement this. -
getValue
Returns the result of evaluating the given key chain on the given object. -
getValue
Returns the result of evaluating the given key chain on the given object. -
getValue
Returns the result of evaluating the given key chain on the given object. -
getValueImpl
Returns the result of evaluating the given key chain on the given object. Broken out so objects can implement custom getKeyChainValue but still have access to default implementation. -
getValueList
Returns the result of evaluating the given key chain on the given list. -
getStringValue
Convenience - returns a string for an object and key chain. -
getNumberValue
Convenience - returns a number for an object and key chain. -
getIntValue
Convenience - returns an int for an object and key chain. -
getFloatValue
Convenience - returns a float for an object and key chain. -
getDoubleValue
Convenience - returns a double for an object and key chain. -
getBoolValue
Convenience - returns a boolean for an object and key chain. -
getListValue
Convenience - returns a list for an object and key chain. -
getValue
Returns a key value if it is of given class (otherwise null). -
anyKeyReferencesKey
Returns whether given key is used anywhere in expression. Current version is really hard coded to require key to be isolated (not a part of a key chain). -
hasPageReference
public boolean hasPageReference()Returns whether given key has a Page/PageMax key reference. -
hasOp
Returns whether key contains given op. -
getError
Returns the last error encountered by the key chain parser (or null). -
getAndResetError
Returns the last error encountered by the key chain parser and resets parser. -
setValue
Sets the given value for the given key chain + property. This is a real bogus loser implementation. -
setValue
Sets the given value for the given key chain + property. This is a real bogus loser implementation that only supports Op.Key and Op.Chain. -
setEnumValue
Sets the given value for the given key chain + property. This is a real bogus loser implementation. -
setValueSafe
Sets the value but only prints a warning if it fails. -
setValueSilent
Tries to set value in given object, ignoring failure exceptions. -
toString
Returns a string representation of the key chain. -
addFunctionClass
Adds a class to the list of classes that RM queries for functions.
-