Package com.reportmill.base
Class RMKeyChain
- java.lang.Object
- 
- com.reportmill.base.RMKeyChain
 
- 
 public class RMKeyChain extends java.lang.ObjectThis class provides the powerful RMKeyChain.valueForKeyChain() functiionality.
- 
- 
Field SummaryFields Modifier and Type Field Description static byteAddstatic byteAndstatic byteArgListstatic byteArrayIndexstatic byteAssignmentstatic byteConditionalstatic byteDividestatic byteEqualstatic byteFunctionCallstatic byteGreaterThanstatic byteGreaterThanOrEqualstatic byteKeystatic byteLessThanstatic byteLessThanOrEqualstatic byteModstatic byteMultiplystatic byteNegatestatic byteNotstatic byteNotEqualstatic byteNullstatic byteOrstatic byteStringstatic byteSubtractstatic byteValue
 - 
Constructor SummaryConstructors Constructor Description RMKeyChain(byte oper)Node constructor.RMKeyChain(byte oper, java.lang.Object child)Node constructor.RMKeyChain(byte oper, 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 c)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 booleanbooleanValueForKeyChain(java.lang.Object anObj, java.lang.Object aKeyChain)VFK convenience - returns a boolean for an object and keychain.java.lang.Objectclone()Standard clone implementation.static doubledoubleValueForKeyChain(java.lang.Object anObj, java.lang.Object aKeyChain)VFK convenience - returns a double for an object and keychain.booleanequals(java.lang.Object anObj)Standard equals implementation.static java.lang.reflect.MethodfindAggregateMethod(java.lang.String aString)Returns a method for a method name (assuming {List,KeyChain} args).static java.lang.reflect.MethodfindFunctionMethod(java.lang.String aString, java.lang.Class[] argClasses)Returns a method for a method name and the given argument classes.static floatfloatValueForKeyChain(java.lang.Object anObj, java.lang.Object aKeyChain)VFK convenience - returns a float for an object and keychain.static java.lang.StringgetAndResetError()Returns the last error encountered by the keychain parser and resets paser.static java.util.MapgetAssignments()Returns a thread-local assignments map.java.lang.ObjectgetChild(int i)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 java.lang.StringgetError()Returns the last error encountered by the keychain parser (or null).RMKeyChaingetNext()Returns the next keychain in the chain.bytegetOperand()Returns the top level operand of the keychain.java.lang.ObjectgetValue()Returns the value of the keychain.java.lang.StringgetValueString()Returns the value of the keychain as a string.booleanhasAggregate()Returns whether key has an aggregate key in it.booleanhasOp(int anOp)Returns whether key contains given op.booleanhasPageReference()Returns whether given key has a Page/PageMax key reference.static intintValueForKeyChain(java.lang.Object anObj, java.lang.Object aKeyChain)VFK convenience - returns an int for an object and keychain.static RMKeyChainkeyChain(java.lang.Object aSource)Returns a keyChain for aSource (should be a String or existing RMKeyChain).static java.util.ListlistValueForKeyChain(java.lang.Object anObj, java.lang.Object aKeyChain)VFK convenience - returns a list for an object and keychain.static voidmain(java.lang.String[] args)Simple main implementation, so RM's expressions can be used for simple math.voidsetLastNode(RMKeyChain ln)Sets the last node in the keychain.voidsetNext(RMKeyChain aKeyChain)Sets the next keychain in the chain.voidsetValue(java.lang.Object val)Sets the value of the keychain.static voidsetValueForKeyChain(java.lang.Object anObj, java.lang.Object aKeyChain, java.lang.Object aValue)static java.lang.StringstringValueForKeyChain(java.lang.Object anObj, java.lang.Object aKeyChain)VFK convenience - returns a string for an object and keychain.static java.lang.Objectsuper_valueForKeyChain(java.lang.Object anObj, RMKeyChain aKeyChain)Returns the result of evaluating the given key chain on the given object.java.lang.StringtoString()Returns a string representation of the keychain.static java.lang.ObjectvalueForKeyChain(java.lang.Object anObj, java.lang.Object aKeyChain)Returns the result of evaluating the given key chain on the given object.static java.lang.ObjectvalueForKeyChainFunctionCall(java.lang.Object anObj, RMKeyChain aKeyChain)Returns the result of evaluating the given key chain (assumed to be a function) on the given object.static java.lang.ObjectvalueForKeyChainKey(java.lang.Object anObj, RMKeyChain aKeyChain)Returns the result of evaluating the given key chain (assumed to be a simple key) on the given object.static java.lang.ObjectvalueForKeyChainList(java.util.List aList, RMKeyChain aKeyChain)Returns the result of evaluating the given keychain on the given list.
 
- 
- 
- 
Field Detail- 
Addpublic static final byte Add - See Also:
- Constant Field Values
 
 - 
Subtractpublic static final byte Subtract - See Also:
- Constant Field Values
 
 - 
Multiplypublic static final byte Multiply - See Also:
- Constant Field Values
 
 - 
Dividepublic static final byte Divide - See Also:
- Constant Field Values
 
 - 
Modpublic static final byte Mod - See Also:
- Constant Field Values
 
 - 
Negatepublic static final byte Negate - See Also:
- Constant Field Values
 
 - 
Keypublic static final byte Key - See Also:
- Constant Field Values
 
 - 
Valuepublic static final byte Value - See Also:
- Constant Field Values
 
 - 
Stringpublic static final byte String - See Also:
- Constant Field Values
 
 - 
ArgListpublic static final byte ArgList - See Also:
- Constant Field Values
 
 - 
FunctionCallpublic static final byte FunctionCall - See Also:
- Constant Field Values
 
 - 
ArrayIndexpublic static final byte ArrayIndex - See Also:
- Constant Field Values
 
 - 
Nullpublic static final byte Null - See Also:
- Constant Field Values
 
 - 
GreaterThanpublic static final byte GreaterThan - See Also:
- Constant Field Values
 
 - 
LessThanpublic static final byte LessThan - See Also:
- Constant Field Values
 
 - 
GreaterThanOrEqualpublic static final byte GreaterThanOrEqual - See Also:
- Constant Field Values
 
 - 
LessThanOrEqualpublic static final byte LessThanOrEqual - See Also:
- Constant Field Values
 
 - 
Equalpublic static final byte Equal - See Also:
- Constant Field Values
 
 - 
NotEqualpublic static final byte NotEqual - See Also:
- Constant Field Values
 
 - 
Notpublic static final byte Not - See Also:
- Constant Field Values
 
 - 
Andpublic static final byte And - See Also:
- Constant Field Values
 
 - 
Orpublic static final byte Or - See Also:
- Constant Field Values
 
 - 
Conditionalpublic static final byte Conditional - See Also:
- Constant Field Values
 
 - 
Assignmentpublic static final byte Assignment - See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
RMKeyChainpublic RMKeyChain(byte oper) Node constructor.
 - 
RMKeyChainpublic RMKeyChain(byte oper, java.lang.Object child)Node constructor.
 - 
RMKeyChainpublic RMKeyChain(byte oper, 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- 
keyChainpublic static RMKeyChain keyChain(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.
 - 
getOperandpublic byte getOperand() Returns the top level operand of the keychain.
 - 
getNextpublic RMKeyChain getNext() Returns the next keychain in the chain.
 - 
setNextpublic void setNext(RMKeyChain aKeyChain) Sets the next keychain in the chain.
 - 
setLastNodepublic void setLastNode(RMKeyChain ln) Sets the last node in 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.
 - 
setValuepublic void setValue(java.lang.Object val) Sets the value of the keychain.
 - 
getChildCountpublic int getChildCount() Returns the number of children in the keychain.
 - 
getChildpublic java.lang.Object getChild(int i) Returns the child at the given index in the keychain.
 - 
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.
 - 
addChildpublic void addChild(java.lang.Object child) Adds a child to the end of the keychain's child list.
 - 
valueForKeyChainpublic static java.lang.Object valueForKeyChain(java.lang.Object anObj, java.lang.Object aKeyChain)Returns the result of evaluating the given key chain on the given object.
 - 
setValueForKeyChainpublic static void setValueForKeyChain(java.lang.Object anObj, java.lang.Object aKeyChain, java.lang.Object aValue)
 - 
super_valueForKeyChainpublic static java.lang.Object super_valueForKeyChain(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 valueForKeyChain but still have access to default implementation.
 - 
valueForKeyChainKeypublic static java.lang.Object valueForKeyChainKey(java.lang.Object anObj, RMKeyChain aKeyChain)Returns the result of evaluating the given key chain (assumed to be a simple key) on the given object.
 - 
valueForKeyChainFunctionCallpublic static java.lang.Object valueForKeyChainFunctionCall(java.lang.Object anObj, RMKeyChain aKeyChain)Returns the result of evaluating the given key chain (assumed to be a function) on the given object.
 - 
valueForKeyChainListpublic static java.lang.Object valueForKeyChainList(java.util.List aList, RMKeyChain aKeyChain)Returns the result of evaluating the given keychain on the given list.
 - 
stringValueForKeyChainpublic static java.lang.String stringValueForKeyChain(java.lang.Object anObj, java.lang.Object aKeyChain)VFK convenience - returns a string for an object and keychain.
 - 
intValueForKeyChainpublic static int intValueForKeyChain(java.lang.Object anObj, java.lang.Object aKeyChain)VFK convenience - returns an int for an object and keychain.
 - 
floatValueForKeyChainpublic static float floatValueForKeyChain(java.lang.Object anObj, java.lang.Object aKeyChain)VFK convenience - returns a float for an object and keychain.
 - 
doubleValueForKeyChainpublic static double doubleValueForKeyChain(java.lang.Object anObj, java.lang.Object aKeyChain)VFK convenience - returns a double for an object and keychain.
 - 
booleanValueForKeyChainpublic static boolean booleanValueForKeyChain(java.lang.Object anObj, java.lang.Object aKeyChain)VFK convenience - returns a boolean for an object and keychain.
 - 
listValueForKeyChainpublic static java.util.List listValueForKeyChain(java.lang.Object anObj, java.lang.Object aKeyChain)VFK convenience - returns a list for an object and keychain.
 - 
addFunctionClasspublic static void addFunctionClass(java.lang.Class c) Adds a class to the list of classes that RM queries for functions.
 - 
findAggregateMethodpublic static java.lang.reflect.Method findAggregateMethod(java.lang.String aString) Returns a method for a method name (assuming {List,KeyChain} args).
 - 
findFunctionMethodpublic static java.lang.reflect.Method findFunctionMethod(java.lang.String aString, java.lang.Class[] argClasses)Returns a method for a method name and the given argument classes.
 - 
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(int anOp) Returns whether key contains given op.
 - 
hasAggregatepublic boolean hasAggregate() Returns whether key has an aggregate key in it.
 - 
getErrorpublic static java.lang.String getError() Returns the last error encountered by the keychain parser (or null).
 - 
getAndResetErrorpublic static java.lang.String getAndResetError() Returns the last error encountered by the keychain parser and resets paser.
 - 
toStringpublic java.lang.String toString() Returns a string representation of the keychain.- Overrides:
- toStringin class- java.lang.Object
 
 - 
clonepublic java.lang.Object clone() Standard clone implementation.- Overrides:
- clonein class- java.lang.Object
 
 - 
equalspublic boolean equals(java.lang.Object anObj) Standard equals implementation.- Overrides:
- equalsin class- java.lang.Object
 
 - 
mainpublic static void main(java.lang.String[] args) Simple main implementation, so RM's expressions can be used for simple math.
 
- 
 
-