Package com.inductiveautomation.rm.base
Class RMKeyChain
- java.lang.Object
- 
- com.inductiveautomation.rm.base.RMKeyChain
 
- 
 public class RMKeyChain extends java.lang.ObjectThis class evaluates a string expression on a given object: RMKeyChain.getValue(object, expression).
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static interfaceRMKeyChain.GetThis is interface is implemented by objects that can get key chain values themselves.static classRMKeyChain.Op
 - 
Constructor SummaryConstructors Constructor Description RMKeyChain(RMKeyChain.Op anOp)Node constructor.RMKeyChain(RMKeyChain.Op anOp, java.lang.Object child)Node constructor.RMKeyChain(RMKeyChain.Op anOp, java.lang.Object left, java.lang.Object right)Node constructor.RMKeyChain(java.lang.Object cond, java.lang.Object tExp, java.lang.Object fExp)Node constructor.
 - 
Method SummaryAll Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddChild(java.lang.Object child)Adds a child to the end of the keychain's child list.static voidaddFunctionClass(java.lang.Class aClass)Adds a class to the list of classes that RM queries for functions.booleananyKeyReferencesKey(java.lang.String aKey)Returns whether given key is used anywhere in expression.static java.lang.StringgetAndResetError()Returns the last error encountered by the key chain parser and resets parser.static java.util.MapgetAssignments()Returns a thread-local assignments map.static booleangetBoolValue(java.lang.Object anObj, java.lang.Object aKeyChain)Convenience - returns a boolean for an object and key chain.java.lang.ObjectgetChild(int anIndex)Returns the child at the given index in the keychain.intgetChildCount()Returns the number of children in the keychain.RMKeyChaingetChildKeyChain(int i)Returns the child at the given index in the keychain as a keychain.java.lang.StringgetChildString(int i)Returns the child at the given index in the keychain as a string.static doublegetDoubleValue(java.lang.Object anObj, java.lang.Object aKeyChain)Convenience - returns a double for an object and key chain.static java.lang.StringgetError()Returns the last error encountered by the key chain parser (or null).static floatgetFloatValue(java.lang.Object anObj, java.lang.Object aKeyChain)Convenience - returns a float for an object and key chain.static intgetIntValue(java.lang.Object anObj, java.lang.Object aKeyChain)Convenience - returns an int for an object and key chain.static RMKeyChaingetKeyChain(java.lang.Object aSource)Returns a keyChain for aSource (should be a String or existing RMKeyChain).static java.util.ListgetListValue(java.lang.Object anObj, java.lang.Object aKeyChain)Convenience - returns a list for an object and key chain.static java.lang.NumbergetNumberValue(java.lang.Object anObj, java.lang.Object aKeyChain)Convenience - returns a number for an object and key chain.RMKeyChain.OpgetOp()Returns the top level operator of the keychain.static java.lang.StringgetStringValue(java.lang.Object anObj, java.lang.Object aKeyChain)Convenience - returns a string for an object and key chain.java.lang.ObjectgetValue()Returns the value of the keychain.static java.lang.ObjectgetValue(java.lang.Object anObj, RMKeyChain aKeyChain)Returns the result of evaluating the given key chain on the given object.static java.lang.ObjectgetValue(java.lang.Object anObj, java.lang.Object aKeyChain)Returns the result of evaluating the given key chain on the given object.static java.lang.ObjectgetValue(java.lang.Object aRoot, java.lang.Object anObj, RMKeyChain aKeyChain)Returns the result of evaluating the given key chain on the given object.static <T> TgetValue(java.lang.Object anObj, java.lang.Object aKeyChain, java.lang.Class<T> aClass)Returns a key value if it is of given class (otherwise null).static java.lang.ObjectgetValueImpl(java.lang.Object aRoot, java.lang.Object anObj, RMKeyChain aKeyChain)Returns the result of evaluating the given key chain on the given object.static java.lang.ObjectgetValueList(java.util.List aList, RMKeyChain aKeyChain)Returns the result of evaluating the given key chain on the given list.java.lang.StringgetValueString()Returns the value of the keychain as a string.booleanhasOp(RMKeyChain.Op anOp)Returns whether key contains given op.booleanhasPageReference()Returns whether given key has a Page/PageMax key reference.static voidsetEnumValue(java.lang.Object anObj, RMKeyChain aKeyChain)Sets the given value for the given key chain + property.static voidsetValue(java.lang.Object anObj, RMKeyChain aKeyChain, java.lang.Object aValue)Sets the given value for the given key chain + property.static voidsetValue(java.lang.Object anObj, java.lang.Object aKeyChain, java.lang.Object aValue)Sets the given value for the given key chain + property.static voidsetValueSafe(java.lang.Object anObj, java.lang.String aKey, java.lang.Object aValue)Sets the value but only prints a warning if it fails.static voidsetValueSilent(java.lang.Object anObj, java.lang.String aKey, java.lang.Object aValue)Tries to set value in given object, ignoring failure exceptions.RMKeyChainsubchain(int anIndex)Override to give list chance to implement this.java.lang.StringtoString()Returns a string representation of the key chain.
 
- 
- 
- 
Constructor Detail- 
RMKeyChainpublic RMKeyChain(RMKeyChain.Op anOp) Node constructor.
 - 
RMKeyChainpublic RMKeyChain(RMKeyChain.Op anOp, java.lang.Object child) Node constructor.
 - 
RMKeyChainpublic RMKeyChain(RMKeyChain.Op anOp, java.lang.Object left, java.lang.Object right) Node constructor.
 - 
RMKeyChainpublic RMKeyChain(java.lang.Object cond, java.lang.Object tExp, java.lang.Object fExp)Node constructor.
 
- 
 - 
Method Detail- 
getKeyChainpublic static RMKeyChain getKeyChain(@Nullable java.lang.Object aSource) Returns a keyChain for aSource (should be a String or existing RMKeyChain).
 - 
getAssignmentspublic static java.util.Map getAssignments() Returns a thread-local assignments map.
 - 
getOppublic RMKeyChain.Op getOp() Returns the top level operator of the keychain.
 - 
getValuepublic java.lang.Object getValue() Returns the value of the keychain.
 - 
getValueStringpublic java.lang.String getValueString() Returns the value of the keychain as a string.
 - 
getChildCountpublic int getChildCount() Returns the number of children in the keychain.
 - 
getChildpublic java.lang.Object getChild(int anIndex) Returns the child at the given index in the keychain.
 - 
addChildpublic void addChild(java.lang.Object child) Adds a child to the end of the keychain's child list.
 - 
getChildStringpublic java.lang.String getChildString(int i) Returns the child at the given index in the keychain as a string.
 - 
getChildKeyChainpublic RMKeyChain getChildKeyChain(int i) Returns the child at the given index in the keychain as a keychain.
 - 
subchainpublic RMKeyChain subchain(int anIndex) Override to give list chance to implement this.
 - 
getValue@Nullable public static java.lang.Object getValue(@Nullable java.lang.Object anObj, @Nullable java.lang.Object aKeyChain)Returns the result of evaluating the given key chain on the given object.
 - 
getValue@Nullable public static java.lang.Object getValue(java.lang.Object anObj, RMKeyChain aKeyChain)Returns the result of evaluating the given key chain on the given object.
 - 
getValuepublic static java.lang.Object getValue(java.lang.Object aRoot, java.lang.Object anObj, RMKeyChain aKeyChain)Returns the result of evaluating the given key chain on the given object.
 - 
getValueImplpublic static java.lang.Object getValueImpl(java.lang.Object aRoot, java.lang.Object anObj, RMKeyChain aKeyChain)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.
 - 
getValueListpublic static java.lang.Object getValueList(java.util.List aList, RMKeyChain aKeyChain)Returns the result of evaluating the given key chain on the given list.
 - 
getStringValuepublic static java.lang.String getStringValue(java.lang.Object anObj, java.lang.Object aKeyChain)Convenience - returns a string for an object and key chain.
 - 
getNumberValuepublic static java.lang.Number getNumberValue(java.lang.Object anObj, java.lang.Object aKeyChain)Convenience - returns a number for an object and key chain.
 - 
getIntValuepublic static int getIntValue(java.lang.Object anObj, java.lang.Object aKeyChain)Convenience - returns an int for an object and key chain.
 - 
getFloatValuepublic static float getFloatValue(java.lang.Object anObj, java.lang.Object aKeyChain)Convenience - returns a float for an object and key chain.
 - 
getDoubleValuepublic static double getDoubleValue(java.lang.Object anObj, java.lang.Object aKeyChain)Convenience - returns a double for an object and key chain.
 - 
getBoolValuepublic static boolean getBoolValue(java.lang.Object anObj, java.lang.Object aKeyChain)Convenience - returns a boolean for an object and key chain.
 - 
getListValue@Nullable public static java.util.List getListValue(java.lang.Object anObj, java.lang.Object aKeyChain)Convenience - returns a list for an object and key chain.
 - 
getValuepublic static <T> T getValue(java.lang.Object anObj, java.lang.Object aKeyChain, java.lang.Class<T> aClass)Returns a key value if it is of given class (otherwise null).
 - 
anyKeyReferencesKeypublic boolean anyKeyReferencesKey(java.lang.String aKey) 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).
 - 
hasPageReferencepublic boolean hasPageReference() Returns whether given key has a Page/PageMax key reference.
 - 
hasOppublic boolean hasOp(RMKeyChain.Op anOp) Returns whether key contains given op.
 - 
getErrorpublic static java.lang.String getError() Returns the last error encountered by the key chain parser (or null).
 - 
getAndResetErrorpublic static java.lang.String getAndResetError() Returns the last error encountered by the key chain parser and resets parser.
 - 
setValuepublic static void setValue(java.lang.Object anObj, java.lang.Object aKeyChain, java.lang.Object aValue)Sets the given value for the given key chain + property. This is a real bogus loser implementation.
 - 
setValuepublic static void setValue(java.lang.Object anObj, RMKeyChain aKeyChain, java.lang.Object aValue)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.
 - 
setEnumValuepublic static void setEnumValue(java.lang.Object anObj, RMKeyChain aKeyChain)Sets the given value for the given key chain + property. This is a real bogus loser implementation.
 - 
setValueSafepublic static void setValueSafe(java.lang.Object anObj, java.lang.String aKey, java.lang.Object aValue)Sets the value but only prints a warning if it fails.
 - 
setValueSilentpublic static void setValueSilent(java.lang.Object anObj, java.lang.String aKey, java.lang.Object aValue)Tries to set value in given object, ignoring failure exceptions.
 - 
toStringpublic java.lang.String toString() Returns a string representation of the key chain.- Overrides:
- toStringin class- java.lang.Object
 
 - 
addFunctionClasspublic static void addFunctionClass(java.lang.Class aClass) Adds a class to the list of classes that RM queries for functions.
 
- 
 
-