public class ExpressionVisitors
extends java.lang.Object
expressions
.Modifier and Type | Class and Description |
---|---|
static class |
ExpressionVisitors.BoundExpressionVisitor<R> |
static class |
ExpressionVisitors.BoundVisitor<R> |
static class |
ExpressionVisitors.CustomOrderExpressionVisitor<R> |
static class |
ExpressionVisitors.ExpressionVisitor<R> |
Modifier and Type | Method and Description |
---|---|
static <R> R |
visit(Expression expr,
ExpressionVisitors.CustomOrderExpressionVisitor<R> visitor)
Traverses the given
expression with a visitor . |
static <R> R |
visit(Expression expr,
ExpressionVisitors.ExpressionVisitor<R> visitor)
Traverses the given
expression with a visitor . |
static java.lang.Boolean |
visitEvaluator(Expression expr,
ExpressionVisitors.ExpressionVisitor<java.lang.Boolean> visitor)
Traverses the given
expression with a visitor . |
public static <R> R visit(Expression expr, ExpressionVisitors.ExpressionVisitor<R> visitor)
expression
with a visitor
.
The visitor will be called to handle each node in the expression tree in postfix order. Result values produced by child nodes are passed when parent nodes are handled.
R
- the return type produced by the expression visitorexpr
- an expression to traversevisitor
- a visitor that will be called to handle each node in the expression treepublic static java.lang.Boolean visitEvaluator(Expression expr, ExpressionVisitors.ExpressionVisitor<java.lang.Boolean> visitor)
expression
with a visitor
.
The visitor will be called to handle only nodes required for determining result in the expression tree in postfix order. Result values produced by child nodes are passed when parent nodes are handled.
expr
- an expression to traversevisitor
- a visitor that will be called to handle each node in the expression treepublic static <R> R visit(Expression expr, ExpressionVisitors.CustomOrderExpressionVisitor<R> visitor)
expression
with a visitor
.
This passes a Supplier
to each non-leaf visitor
method. The supplier returns the result of traversing child expressions. Getting the result of
the supplier allows traversing the expression in the desired order.
R
- the return type produced by the expression visitorexpr
- an expression to traversevisitor
- a visitor that will be called to handle each node in the expression tree