Class TreeMatcher<T extends Tree>
java.lang.Object
org.sonar.java.matcher.TreeMatcher<T>
-
Method Summary
Modifier and TypeMethodDescriptionand
(TreeMatcher<T> other) static <U extends Tree>
TreeMatcher<U> any()
static TreeMatcher
<ExpressionTree> calls
(MethodMatchers methodMatchers) static TreeMatcher
<ExpressionTree> calls
(MethodMatchers methodMatchers, TreeMatcher<MethodInvocationTree> methodInvocationMatcher) boolean
static TreeMatcher
<StatementTree> forEachStatement
(TreeMatcher<ForEachStatement> forEachMatcher) static TreeMatcher
<Tree> hasSize
(int size) static TreeMatcher
<MethodInvocationTree> invokedOn
(TreeMatcher<ExpressionTree> expressionMatcher) static TreeMatcher
<ExpressionTree> isCall
(TreeMatcher<MethodInvocationTree> methodInvocationMatcher) static TreeMatcher
<Tree> isExpression
(TreeMatcher<ExpressionTree> expressionMatcher) static TreeMatcher
<ExpressionTree> isIdentifier
(String name) static TreeMatcher
<ExpressionTree> isIdentifier
(Symbol symbol) static TreeMatcher
<ExpressionTree> isIdentifier
(IdentifierTree identifier) static TreeMatcher
<StatementTree> isInvocation
(TreeMatcher<MethodInvocationTree> methodInvocationMatcher) static TreeMatcher
<StatementTree> isInvocationOf
(MethodMatchers methodMatchers) static TreeMatcher
<StatementTree> isInvocationOf
(MethodMatchers methodMatchers, TreeMatcher<MethodInvocationTree> methodInvocationMatcher) static TreeMatcher
<ExpressionTree> isLambdaExpression
(TreeMatcher<LambdaExpressionTree> lambdaMatcher) static <U extends Tree>
TreeMatcher<U> or
(TreeMatcher<T> other) static <T extends Tree>
TreeMatcher<T> recursive
(UnaryOperator<TreeMatcher<T>> treeMatcherMaker) Method to allow defining a matcher that refers to itself.static TreeMatcher
<Tree> statementAt
(int index, TreeMatcher<StatementTree> statementMatcher) static TreeMatcher
<MethodInvocationTree> withArgument
(int index, TreeMatcher<ExpressionTree> expressionMatcher) static TreeMatcher
<LambdaExpressionTree> withBody
(TreeMatcher<Tree> bodyMatcher) static TreeMatcher
<ForEachStatement> withExpression
(TreeMatcher<ExpressionTree> expressionMatcher)
-
Method Details
-
check
-
and
-
or
-
recursive
public static <T extends Tree> TreeMatcher<T> recursive(UnaryOperator<TreeMatcher<T>> treeMatcherMaker) Method to allow defining a matcher that refers to itself. -
matching
-
any
-
asPredicate
-
calls
public static TreeMatcher<ExpressionTree> calls(MethodMatchers methodMatchers, TreeMatcher<MethodInvocationTree> methodInvocationMatcher) -
calls
-
isCall
public static TreeMatcher<ExpressionTree> isCall(TreeMatcher<MethodInvocationTree> methodInvocationMatcher) -
isInvocationOf
public static TreeMatcher<StatementTree> isInvocationOf(MethodMatchers methodMatchers, TreeMatcher<MethodInvocationTree> methodInvocationMatcher) -
isInvocationOf
-
isInvocation
public static TreeMatcher<StatementTree> isInvocation(TreeMatcher<MethodInvocationTree> methodInvocationMatcher) -
isIdentifier
-
isIdentifier
-
isIdentifier
-
isLambdaExpression
public static TreeMatcher<ExpressionTree> isLambdaExpression(TreeMatcher<LambdaExpressionTree> lambdaMatcher) -
withBody
-
isExpression
-
hasSize
-
statementAt
-
forEachStatement
public static TreeMatcher<StatementTree> forEachStatement(TreeMatcher<ForEachStatement> forEachMatcher) -
withExpression
public static TreeMatcher<ForEachStatement> withExpression(TreeMatcher<ExpressionTree> expressionMatcher) -
invokedOn
public static TreeMatcher<MethodInvocationTree> invokedOn(TreeMatcher<ExpressionTree> expressionMatcher) -
withArgument
public static TreeMatcher<MethodInvocationTree> withArgument(int index, TreeMatcher<ExpressionTree> expressionMatcher)
-