All Packages Class Hierarchy This Package Previous Next Index
Class org.webmacro.engine.Condition
java.lang.Object
|
+----org.webmacro.engine.Condition
- public abstract class Condition
- extends Object
- implements Macro
Conditions evaluate() to Boolean.TRUE or Boolean.FALSE
depending on its contents and the supplied context.
You can build expressions from a combination of the
operators ! && || == and Terms; you can also group
sub-expressions with parentheses. An expression is true if
it is non-null; and false if it is Boolean.FALSE or null.
Beware that null values incur a slight performance penalty;
therefore we recommend you use boolean values in expressions
wherever possible.
-
Condition()
-
-
evaluate(Object)
- Return an object representing this condition
-
parse(ParseTool)
-
Parse the expression and return a macro that will evaluate
to Boolean.TRUE or Boolean.FALSE depending on the condition.
-
parseCond(ParseTool)
- Exactly the same as parse(), but return type is Condition
-
test(Object)
- Returns true if the condition is logically true; returns false if the
condition is either logically false or undefined.
-
write(Writer, Object)
- Evaluate the condition and write it out
Condition
public Condition()
parse
public static final Object parse(ParseTool in) throws ParseException, IOException
- Parse the expression and return a macro that will evaluate
to Boolean.TRUE or Boolean.FALSE depending on the condition.
- Returns:
- boolean
- Throws: ParseException
- if the sytax was invalid and we could not recover
- Throws: IOException
- if we could not successfullly read the parseTool
parseCond
public static Condition parseCond(ParseTool in) throws ParseException, IOException
- Exactly the same as parse(), but return type is Condition
write
public final void write(Writer out,
Object context) throws InvalidContextException, IOException
- Evaluate the condition and write it out
evaluate
public Object evaluate(Object context) throws InvalidContextException
- Return an object representing this condition
test
public abstract boolean test(Object context)
- Returns true if the condition is logically true; returns false if the
condition is either logically false or undefined.
All Packages Class Hierarchy This Package Previous Next Index