er.extensions.foundation
Class ERXBooleanExpressionParser
java.lang.Object
er.extensions.foundation.ERXBooleanExpressionParser
public class ERXBooleanExpressionParser
- extends java.lang.Object
Parses a boolean expression and evaluates that boolean expression against a valueProvider object that returns boolean values
for the variable symbols found in the boolean expression.
The valueProvider object must implement NSKeyValueCodingAdditions interface.
Acceptable boolean expressions can use the words AND, OR and NOT in upper, lower or mixed case. Parentheses can be
used as needed to group elements of the expression.
Variable symbols in the boolean expression can use characters and formatting of typical keys or keyPaths.
All other words besides AND, OR and NOT are assumed to be variables (aka keyPaths) which resolve to Boolean values when
valueForKeyPath is invoked on the valueProvider object (which can be a NSDictionary of variable values or any object that
implements NSKeyValueCodingAdditions
)
For example
Expression: (canViewPerson AND canEditPerson) OR (isTheBoss AND NOT account.isAccountDisabled)
- Author:
- kieran
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
ERXBooleanExpressionParser
public ERXBooleanExpressionParser(java.lang.String expression)
evaluateWithObject
public boolean evaluateWithObject(com.webobjects.foundation.NSKeyValueCodingAdditions valueProvider)
- Returns:
- the result of the boolean expression when evaluated with valueProvider
qualifier
public com.webobjects.eocontrol.EOQualifier qualifier()
- Returns:
- the EOQualifier resulting from the boolean expression. Leaving this as public since it is useful for debugging the expression morphing in WOComponents
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
toDebugString
public java.lang.String toDebugString()
Copyright © 2002 – 2007 Project Wonder.