R1
- the type result of visitSwitchResultExpression(ExpressionTree, Object)
P1
- the type of the parameter to pass to visitSwitchResultExpression(ExpressionTree, Object)
public static class SwitchExpressionScanner.FunctionalSwitchExpressionScanner<R1,P1> extends SwitchExpressionScanner<R1,P1>
SwitchExpressionScanner
that uses functions passed to the
constructor for visitSwitchResultExpression(ExpressionTree, Object)
and combineResults(Object, Object)
.SwitchExpressionScanner.FunctionalSwitchExpressionScanner<R1,P1>, SwitchExpressionScanner.YieldVisitor
yieldVisitor
Constructor and Description |
---|
FunctionalSwitchExpressionScanner(BiFunction<ExpressionTree,P1,R1> switchValueExpressionFunc,
BiFunction<R1,R1,R1> combineResultFunc)
Creates a
SwitchExpressionScanner.FunctionalSwitchExpressionScanner that uses the given functions. |
Modifier and Type | Method and Description |
---|---|
protected R1 |
combineResults(R1 r1,
R1 r2)
This method combines the result of two calls to
SwitchExpressionScanner.visitSwitchResultExpression(ExpressionTree, Object) or null and the result of one
call to SwitchExpressionScanner.visitSwitchResultExpression(ExpressionTree, Object) . |
protected R1 |
visitSwitchResultExpression(ExpressionTree resultExpressionTree,
P1 p1)
This method is called for each result expression of the switch expression passed in
SwitchExpressionScanner.scanSwitchExpression(Tree, Object) . |
scanSwitchExpression
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
public FunctionalSwitchExpressionScanner(BiFunction<ExpressionTree,P1,R1> switchValueExpressionFunc, BiFunction<R1,R1,R1> combineResultFunc)
SwitchExpressionScanner.FunctionalSwitchExpressionScanner
that uses the given functions.switchValueExpressionFunc
- the function called on each switch result expressioncombineResultFunc
- the function used to combine the result of multiple calls to switchValueExpressionFunc
protected R1 visitSwitchResultExpression(ExpressionTree resultExpressionTree, P1 p1)
SwitchExpressionScanner
SwitchExpressionScanner.scanSwitchExpression(Tree, Object)
.visitSwitchResultExpression
in class SwitchExpressionScanner<R1,P1>
resultExpressionTree
- a result expression of the switch expression currently being
scannedp1
- a parameterprotected R1 combineResults(R1 r1, R1 r2)
SwitchExpressionScanner
SwitchExpressionScanner.visitSwitchResultExpression(ExpressionTree, Object)
or null
and the result of one
call to SwitchExpressionScanner.visitSwitchResultExpression(ExpressionTree, Object)
.combineResults
in class SwitchExpressionScanner<R1,P1>
r1
- a possibly null result returned by SwitchExpressionScanner.visitSwitchResultExpression(ExpressionTree, Object)
r2
- a possibly null result returned by SwitchExpressionScanner.visitSwitchResultExpression(ExpressionTree, Object)
r1
and r2