Package com.reportmill.base
Class RMKeyChain
java.lang.Object
com.reportmill.base.RMKeyChain
This class provides the powerful RMKeyChain.valueForKeyChain() functiionality.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
static final byte
-
Constructor Summary
ConstructorsConstructorDescriptionRMKeyChain
(byte oper) Node constructor.RMKeyChain
(byte oper, Object child) Node constructor.RMKeyChain
(byte oper, 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
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 boolean
booleanValueForKeyChain
(Object anObj, Object aKeyChain) VFK convenience - returns a boolean for an object and keychain.clone()
Standard clone implementation.static double
doubleValueForKeyChain
(Object anObj, Object aKeyChain) VFK convenience - returns a double for an object and keychain.boolean
Standard equals implementation.static Method
findAggregateMethod
(String aString) Returns a method for a method name (assuming {List,KeyChain} args).static Method
findFunctionMethod
(String aString, Class[] argClasses) Returns a method for a method name and the given argument classes.static float
floatValueForKeyChain
(Object anObj, Object aKeyChain) VFK convenience - returns a float for an object and keychain.static String
Returns the last error encountered by the keychain parser and resets paser.static Map
Returns a thread-local assignments map.getChild
(int i) 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 String
getError()
Returns the last error encountered by the keychain parser (or null).getNext()
Returns the next keychain in the chain.byte
Returns the top level operand of the keychain.getValue()
Returns the value of the keychain.Returns the value of the keychain as a string.boolean
Returns whether key has an aggregate key in it.boolean
hasOp
(int anOp) Returns whether key contains given op.boolean
Returns whether given key has a Page/PageMax key reference.static int
intValueForKeyChain
(Object anObj, Object aKeyChain) VFK convenience - returns an int for an object and keychain.static RMKeyChain
Returns a keyChain for aSource (should be a String or existing RMKeyChain).static List
listValueForKeyChain
(Object anObj, Object aKeyChain) VFK convenience - returns a list for an object and keychain.static void
Simple main implementation, so RM's expressions can be used for simple math.void
Sets the last node in the keychain.void
setNext
(RMKeyChain aKeyChain) Sets the next keychain in the chain.void
Sets the value of the keychain.static void
setValueForKeyChain
(Object anObj, Object aKeyChain, Object aValue) static String
stringValueForKeyChain
(Object anObj, Object aKeyChain) VFK convenience - returns a string for an object and keychain.static Object
super_valueForKeyChain
(Object anObj, RMKeyChain aKeyChain) Returns the result of evaluating the given key chain on the given object.toString()
Returns a string representation of the keychain.static Object
valueForKeyChain
(Object anObj, Object aKeyChain) Returns the result of evaluating the given key chain on the given object.static Object
valueForKeyChainFunctionCall
(Object anObj, RMKeyChain aKeyChain) Returns the result of evaluating the given key chain (assumed to be a function) on the given object.static Object
valueForKeyChainKey
(Object anObj, RMKeyChain aKeyChain) Returns the result of evaluating the given key chain (assumed to be a simple key) on the given object.static Object
valueForKeyChainList
(List aList, RMKeyChain aKeyChain) Returns the result of evaluating the given keychain on the given list.
-
Field Details
-
Add
public static final byte Add- See Also:
-
Subtract
public static final byte Subtract- See Also:
-
Multiply
public static final byte Multiply- See Also:
-
Divide
public static final byte Divide- See Also:
-
Mod
public static final byte Mod- See Also:
-
Negate
public static final byte Negate- See Also:
-
Key
public static final byte Key- See Also:
-
Value
public static final byte Value- See Also:
-
String
public static final byte String- See Also:
-
ArgList
public static final byte ArgList- See Also:
-
FunctionCall
public static final byte FunctionCall- See Also:
-
ArrayIndex
public static final byte ArrayIndex- See Also:
-
Null
public static final byte Null- See Also:
-
GreaterThan
public static final byte GreaterThan- See Also:
-
LessThan
public static final byte LessThan- See Also:
-
GreaterThanOrEqual
public static final byte GreaterThanOrEqual- See Also:
-
LessThanOrEqual
public static final byte LessThanOrEqual- See Also:
-
Equal
public static final byte Equal- See Also:
-
NotEqual
public static final byte NotEqual- See Also:
-
Not
public static final byte Not- See Also:
-
And
public static final byte And- See Also:
-
Or
public static final byte Or- See Also:
-
Conditional
public static final byte Conditional- See Also:
-
Assignment
public static final byte Assignment- See Also:
-
-
Constructor Details
-
RMKeyChain
public RMKeyChain(byte oper) Node constructor. -
RMKeyChain
Node constructor. -
RMKeyChain
Node constructor. -
RMKeyChain
Node constructor.
-
-
Method Details
-
keyChain
Returns a keyChain for aSource (should be a String or existing RMKeyChain). -
getAssignments
Returns a thread-local assignments map. -
getOperand
public byte getOperand()Returns the top level operand of the keychain. -
getNext
Returns the next keychain in the chain. -
setNext
Sets the next keychain in the chain. -
setLastNode
Sets the last node in the keychain. -
getValue
Returns the value of the keychain. -
getValueString
Returns the value of the keychain as a string. -
setValue
Sets the value of the keychain. -
getChildCount
public int getChildCount()Returns the number of children in the keychain. -
getChild
Returns the child at the given index in the keychain. -
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. -
addChild
Adds a child to the end of the keychain's child list. -
valueForKeyChain
Returns the result of evaluating the given key chain on the given object. -
setValueForKeyChain
-
super_valueForKeyChain
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. -
valueForKeyChainKey
Returns the result of evaluating the given key chain (assumed to be a simple key) on the given object. -
valueForKeyChainFunctionCall
Returns the result of evaluating the given key chain (assumed to be a function) on the given object. -
valueForKeyChainList
Returns the result of evaluating the given keychain on the given list. -
stringValueForKeyChain
VFK convenience - returns a string for an object and keychain. -
intValueForKeyChain
VFK convenience - returns an int for an object and keychain. -
floatValueForKeyChain
VFK convenience - returns a float for an object and keychain. -
doubleValueForKeyChain
VFK convenience - returns a double for an object and keychain. -
booleanValueForKeyChain
VFK convenience - returns a boolean for an object and keychain. -
listValueForKeyChain
VFK convenience - returns a list for an object and keychain. -
addFunctionClass
Adds a class to the list of classes that RM queries for functions. -
findAggregateMethod
Returns a method for a method name (assuming {List,KeyChain} args). -
findFunctionMethod
Returns a method for a method name and the given argument classes. -
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
public boolean hasOp(int anOp) Returns whether key contains given op. -
hasAggregate
public boolean hasAggregate()Returns whether key has an aggregate key in it. -
getError
Returns the last error encountered by the keychain parser (or null). -
getAndResetError
Returns the last error encountered by the keychain parser and resets paser. -
toString
Returns a string representation of the keychain. -
clone
Standard clone implementation. -
equals
Standard equals implementation. -
main
Simple main implementation, so RM's expressions can be used for simple math.
-