R
- the type of the result of visitSwitchResultExpression(ExpressionTree, Object)
P
- the type of the parameter to pass to visitSwitchResultExpression(ExpressionTree, Object)
public abstract class SwitchExpressionScanner<R,P> extends TreeScanner<R,P>
visitSwitchResultExpression(ExpressionTree, Object)
on each result expression. The results of
these method calls are combined using combineResults(Object, Object)
. Call scanSwitchExpression(Tree, Object)
to start scanning the switch expression.
SwitchExpressionScanner.FunctionalSwitchExpressionScanner
can be used to pass functions for to use for visitSwitchResultExpression(ExpressionTree, Object)
and combineResults(Object,
Object)
.
Modifier and Type | Class and Description |
---|---|
static class |
SwitchExpressionScanner.FunctionalSwitchExpressionScanner<R1,P1>
An implementation of
SwitchExpressionScanner that uses functions passed to the
constructor for SwitchExpressionScanner.FunctionalSwitchExpressionScanner.visitSwitchResultExpression(ExpressionTree, Object) and SwitchExpressionScanner.FunctionalSwitchExpressionScanner.combineResults(Object, Object) . |
protected class |
SwitchExpressionScanner.YieldVisitor
A scanner that visits all the yield trees in a given tree and calls
visitSwitchResultExpression(ExpressionTree, Object) on the expression in the yield trees. |
Modifier and Type | Field and Description |
---|---|
protected SwitchExpressionScanner.YieldVisitor |
yieldVisitor
A scanner that visits all the yield trees in a given tree and calls
visitSwitchResultExpression(ExpressionTree, Object) on the expression in the yield trees. |
Constructor and Description |
---|
SwitchExpressionScanner() |
Modifier and Type | Method and Description |
---|---|
protected abstract R |
combineResults(R r1,
R r2)
This method combines the result of two calls to
visitSwitchResultExpression(ExpressionTree, Object) or null and the result of one
call to visitSwitchResultExpression(ExpressionTree, Object) . |
R |
scanSwitchExpression(Tree switchExpression,
P p)
Scans the given switch expression and calls
visitSwitchResultExpression(ExpressionTree,
Object) on each result expression of the switch expression. |
protected abstract R |
visitSwitchResultExpression(ExpressionTree resultExpressionTree,
P p)
This method is called for each result expression of the switch expression passed in
scanSwitchExpression(Tree, Object) . |
reduce, scan, scan, visitAnnotatedType, visitAnnotation, visitArrayAccess, visitArrayType, visitAssert, visitAssignment, visitBinary, visitBlock, visitBreak, visitCase, visitCatch, visitClass, visitCompilationUnit, visitCompoundAssignment, visitConditionalExpression, visitContinue, visitDoWhileLoop, visitEmptyStatement, visitEnhancedForLoop, visitErroneous, visitExports, visitExpressionStatement, visitForLoop, visitIdentifier, visitIf, visitImport, visitInstanceOf, visitIntersectionType, visitLabeledStatement, visitLambdaExpression, visitLiteral, visitMemberReference, visitMemberSelect, visitMethod, visitMethodInvocation, visitModifiers, visitModule, visitNewArray, visitNewClass, visitOpens, visitOther, visitPackage, visitParameterizedType, visitParenthesized, visitPrimitiveType, visitProvides, visitRequires, visitReturn, visitSwitch, visitSynchronized, visitThrow, visitTry, visitTypeCast, visitTypeParameter, visitUnary, visitUnionType, visitUses, visitVariable, visitWhileLoop, visitWildcard
protected SwitchExpressionScanner.YieldVisitor yieldVisitor
visitSwitchResultExpression(ExpressionTree, Object)
on the expression in the yield trees. It
does not descend into switch expressions.protected abstract R visitSwitchResultExpression(ExpressionTree resultExpressionTree, P p)
scanSwitchExpression(Tree, Object)
.resultExpressionTree
- a result expression of the switch expression currently being
scannedp
- a parameterprotected abstract R combineResults(R r1, R r2)
visitSwitchResultExpression(ExpressionTree, Object)
or null
and the result of one
call to visitSwitchResultExpression(ExpressionTree, Object)
.r1
- a possibly null result returned by visitSwitchResultExpression(ExpressionTree, Object)
r2
- a possibly null result returned by visitSwitchResultExpression(ExpressionTree, Object)
r1
and r2
public R scanSwitchExpression(Tree switchExpression, P p)
visitSwitchResultExpression(ExpressionTree,
Object)
on each result expression of the switch expression. combineResults(Object,
Object)
is called to combine the results of visiting multiple switch result expressions.switchExpression
- a switch expression treep
- the parameter to pass to visitSwitchResultExpression(ExpressionTree, Object)
visitSwitchResultExpression(ExpressionTree, Object)
on
each result expression of switchExpression
and combining the results using combineResults(Object, Object)