Package org.sonar.java.matcher
Class MethodMatchersBuilder
java.lang.Object
org.sonar.java.matcher.MethodMatchersBuilder
- All Implemented Interfaces:
MethodMatchers
,MethodMatchers.NameBuilder
,MethodMatchers.ParametersBuilder
,MethodMatchers.TypeBuilder
public class MethodMatchersBuilder
extends Object
implements MethodMatchers.TypeBuilder, MethodMatchers.NameBuilder, MethodMatchers.ParametersBuilder, MethodMatchers
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.sonar.plugins.java.api.semantic.MethodMatchers
MethodMatchers.NameBuilder, MethodMatchers.ParametersBuilder, MethodMatchers.TypeBuilder
-
Field Summary
Fields inherited from interface org.sonar.plugins.java.api.semantic.MethodMatchers
ANY, CONSTRUCTOR
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddParametersMatcher(String... parametersType)
Match a method signature with exactly the types provided.addParametersMatcher(Predicate<List<Type>> parametersPredicate)
Match a method signature respecting the predicate.Match a method signature without parameters.anyName()
Match a method with any name.build()
Build a MethodMatchers.Match a constructor.boolean
boolean
matches(MethodInvocationTree mit)
boolean
matches(MethodReferenceTree methodReferenceTree)
boolean
matches(MethodTree methodTree)
boolean
matches(NewClassTree newClassTree)
Match the name matching the predicate.Match a method with any name is the list.Match any type.ofSubTypes(String... fullyQualifiedTypeNames)
Match any of the type and sub-type of the fully qualified names.Match a type matching a predicate.Match any of the fully qualified name types, but not the subtype.Match a method signature with any number of parameters of any types.
-
Constructor Details
-
MethodMatchersBuilder
public MethodMatchersBuilder()
-
-
Method Details
-
ofSubTypes
Description copied from interface:MethodMatchers.TypeBuilder
Match any of the type and sub-type of the fully qualified names.- Specified by:
ofSubTypes
in interfaceMethodMatchers.TypeBuilder
-
ofAnyType
Description copied from interface:MethodMatchers.TypeBuilder
Match any type.- Specified by:
ofAnyType
in interfaceMethodMatchers.TypeBuilder
-
ofTypes
Description copied from interface:MethodMatchers.TypeBuilder
Match any of the fully qualified name types, but not the subtype.- Specified by:
ofTypes
in interfaceMethodMatchers.TypeBuilder
-
ofType
Description copied from interface:MethodMatchers.TypeBuilder
Match a type matching a predicate.- Specified by:
ofType
in interfaceMethodMatchers.TypeBuilder
-
names
Description copied from interface:MethodMatchers.NameBuilder
Match a method with any name is the list.- Specified by:
names
in interfaceMethodMatchers.NameBuilder
-
anyName
Description copied from interface:MethodMatchers.NameBuilder
Match a method with any name. Equivalent to .name(n -> true).- Specified by:
anyName
in interfaceMethodMatchers.NameBuilder
-
constructor
Description copied from interface:MethodMatchers.NameBuilder
Match a constructor. Equivalent to .name(n -> "".equals(n)) - Specified by:
constructor
in interfaceMethodMatchers.NameBuilder
-
name
Description copied from interface:MethodMatchers.NameBuilder
Match the name matching the predicate.- Specified by:
name
in interfaceMethodMatchers.NameBuilder
-
addParametersMatcher
Description copied from interface:MethodMatchers.ParametersBuilder
Match a method signature with exactly the types provided. Others method adding parameters matcher can be called to match multiples signatures.- Specified by:
addParametersMatcher
in interfaceMethodMatchers.ParametersBuilder
-
addWithoutParametersMatcher
Description copied from interface:MethodMatchers.ParametersBuilder
Match a method signature without parameters. Others method adding parameters matcher can be called to match multiples signatures.- Specified by:
addWithoutParametersMatcher
in interfaceMethodMatchers.ParametersBuilder
-
withAnyParameters
Description copied from interface:MethodMatchers.ParametersBuilder
Match a method signature with any number of parameters of any types. Others method adding parameters matchers can not be called with this method.- Specified by:
withAnyParameters
in interfaceMethodMatchers.ParametersBuilder
-
addParametersMatcher
public MethodMatchers.ParametersBuilder addParametersMatcher(Predicate<List<Type>> parametersPredicate)Description copied from interface:MethodMatchers.ParametersBuilder
Match a method signature respecting the predicate. Others method adding parameters matcher can be called to match multiples signatures.- Specified by:
addParametersMatcher
in interfaceMethodMatchers.ParametersBuilder
-
matches
- Specified by:
matches
in interfaceMethodMatchers
-
matches
- Specified by:
matches
in interfaceMethodMatchers
-
matches
- Specified by:
matches
in interfaceMethodMatchers
-
matches
- Specified by:
matches
in interfaceMethodMatchers
-
matches
- Specified by:
matches
in interfaceMethodMatchers
-
build
Description copied from interface:MethodMatchers.ParametersBuilder
Build a MethodMatchers. Throw an Exception if the MethodMatchers is not correctly setup (no parameters list defined).- Specified by:
build
in interfaceMethodMatchers.ParametersBuilder
-