Class RMKeyChain

java.lang.Object
com.reportmill.base.RMKeyChain

public class RMKeyChain extends Object
This class provides the powerful RMKeyChain.valueForKeyChain() functiionality.
  • Field Details

  • Constructor Details

    • RMKeyChain

      public RMKeyChain(byte oper)
      Node constructor.
    • RMKeyChain

      public RMKeyChain(byte oper, Object child)
      Node constructor.
    • RMKeyChain

      public RMKeyChain(byte oper, Object left, Object right)
      Node constructor.
    • RMKeyChain

      public RMKeyChain(Object cond, Object tExp, Object fExp)
      Node constructor.
  • Method Details

    • keyChain

      public static RMKeyChain keyChain(Object aSource)
      Returns a keyChain for aSource (should be a String or existing RMKeyChain).
    • getAssignments

      public static Map getAssignments()
      Returns a thread-local assignments map.
    • getOperand

      public byte getOperand()
      Returns the top level operand of the keychain.
    • getNext

      public RMKeyChain getNext()
      Returns the next keychain in the chain.
    • setNext

      public void setNext(RMKeyChain aKeyChain)
      Sets the next keychain in the chain.
    • setLastNode

      public void setLastNode(RMKeyChain ln)
      Sets the last node in the keychain.
    • getValue

      public Object getValue()
      Returns the value of the keychain.
    • getValueString

      public String getValueString()
      Returns the value of the keychain as a string.
    • setValue

      public void setValue(Object val)
      Sets the value of the keychain.
    • getChildCount

      public int getChildCount()
      Returns the number of children in the keychain.
    • getChild

      public Object getChild(int i)
      Returns the child at the given index in the keychain.
    • getChildString

      public String getChildString(int i)
      Returns the child at the given index in the keychain as a string.
    • getChildKeyChain

      public RMKeyChain getChildKeyChain(int i)
      Returns the child at the given index in the keychain as a keychain.
    • addChild

      public void addChild(Object child)
      Adds a child to the end of the keychain's child list.
    • valueForKeyChain

      public static Object valueForKeyChain(Object anObj, Object aKeyChain)
      Returns the result of evaluating the given key chain on the given object.
    • setValueForKeyChain

      public static void setValueForKeyChain(Object anObj, Object aKeyChain, Object aValue)
    • super_valueForKeyChain

      public static Object super_valueForKeyChain(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.
    • valueForKeyChainKey

      public 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.
    • valueForKeyChainFunctionCall

      public 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.
    • valueForKeyChainList

      public static Object valueForKeyChainList(List aList, RMKeyChain aKeyChain)
      Returns the result of evaluating the given keychain on the given list.
    • stringValueForKeyChain

      public static String stringValueForKeyChain(Object anObj, Object aKeyChain)
      VFK convenience - returns a string for an object and keychain.
    • intValueForKeyChain

      public static int intValueForKeyChain(Object anObj, Object aKeyChain)
      VFK convenience - returns an int for an object and keychain.
    • floatValueForKeyChain

      public static float floatValueForKeyChain(Object anObj, Object aKeyChain)
      VFK convenience - returns a float for an object and keychain.
    • doubleValueForKeyChain

      public static double doubleValueForKeyChain(Object anObj, Object aKeyChain)
      VFK convenience - returns a double for an object and keychain.
    • booleanValueForKeyChain

      public static boolean booleanValueForKeyChain(Object anObj, Object aKeyChain)
      VFK convenience - returns a boolean for an object and keychain.
    • listValueForKeyChain

      public static List listValueForKeyChain(Object anObj, Object aKeyChain)
      VFK convenience - returns a list for an object and keychain.
    • addFunctionClass

      public static void addFunctionClass(Class c)
      Adds a class to the list of classes that RM queries for functions.
    • findAggregateMethod

      public static Method findAggregateMethod(String aString)
      Returns a method for a method name (assuming {List,KeyChain} args).
    • findFunctionMethod

      public static Method findFunctionMethod(String aString, Class[] argClasses)
      Returns a method for a method name and the given argument classes.
    • anyKeyReferencesKey

      public boolean anyKeyReferencesKey(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).
    • 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

      public static String getError()
      Returns the last error encountered by the keychain parser (or null).
    • getAndResetError

      public static String getAndResetError()
      Returns the last error encountered by the keychain parser and resets paser.
    • toString

      public String toString()
      Returns a string representation of the keychain.
      Overrides:
      toString in class Object
    • clone

      public Object clone()
      Standard clone implementation.
      Overrides:
      clone in class Object
    • equals

      public boolean equals(Object anObj)
      Standard equals implementation.
      Overrides:
      equals in class Object
    • main

      public static void main(String[] args)
      Simple main implementation, so RM's expressions can be used for simple math.