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 interfaceThis 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 TypeMethodDescriptionvoidAdds a child to the end of the keychain's child list.static voidaddFunctionClass(Class aClass) Adds a class to the list of classes that RM queries for functions.booleananyKeyReferencesKey(String aKey) Returns whether given key is used anywhere in expression.static StringReturns the last error encountered by the key chain parser and resets parser.static MapReturns a thread-local assignments map.static booleangetBoolValue(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.intReturns 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 doublegetDoubleValue(Object anObj, Object aKeyChain) Convenience - returns a double for an object and key chain.static StringgetError()Returns the last error encountered by the key chain parser (or null).static floatgetFloatValue(Object anObj, Object aKeyChain) Convenience - returns a float for an object and key chain.static intgetIntValue(Object anObj, Object aKeyChain) Convenience - returns an int for an object and key chain.static RMKeyChaingetKeyChain(Object aSource) Returns a keyChain for aSource (should be a String or existing RMKeyChain).static ListgetListValue(Object anObj, Object aKeyChain) Convenience - returns a list for an object and key chain.static NumbergetNumberValue(Object anObj, Object aKeyChain) Convenience - returns a number for an object and key chain.getOp()Returns the top level operator of the keychain.static StringgetStringValue(Object anObj, Object aKeyChain) Convenience - returns a string for an object and key chain.getValue()Returns the value of the keychain.static ObjectgetValue(Object anObj, RMKeyChain aKeyChain) Returns the result of evaluating the given key chain on the given object.static ObjectReturns the result of evaluating the given key chain on the given object.static ObjectgetValue(Object aRoot, Object anObj, RMKeyChain aKeyChain) Returns the result of evaluating the given key chain on the given object.static <T> TReturns a key value if it is of given class (otherwise null).static ObjectgetValueImpl(Object aRoot, Object anObj, RMKeyChain aKeyChain) Returns the result of evaluating the given key chain on the given object.static ObjectgetValueList(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.booleanhasOp(RMKeyChain.Op anOp) Returns whether key contains given op.booleanReturns whether given key has a Page/PageMax key reference.static voidsetEnumValue(Object anObj, RMKeyChain aKeyChain) Sets the given value for the given key chain + property.static voidsetValue(Object anObj, RMKeyChain aKeyChain, Object aValue) Sets the given value for the given key chain + property.static voidSets the given value for the given key chain + property.static voidsetValueSafe(Object anObj, String aKey, Object aValue) Sets the value but only prints a warning if it fails.static voidsetValueSilent(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.
-