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 Constructor Description MethodMatchersBuilder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MethodMatchers.ParametersBuilderaddParametersMatcher(String... parametersType)Match a method signature with exactly the types provided.MethodMatchers.ParametersBuilderaddParametersMatcher(Predicate<List<Type>> parametersPredicate)Match a method signature respecting the predicate.MethodMatchers.ParametersBuilderaddWithoutParametersMatcher()Match a method signature without parameters.MethodMatchers.ParametersBuilderanyName()Match a method with any name.MethodMatchersbuild()Build a MethodMatchers.MethodMatchers.ParametersBuilderconstructor()Match a constructor.booleanmatches(Symbol symbol)booleanmatches(MethodInvocationTree mit)booleanmatches(MethodReferenceTree methodReferenceTree)booleanmatches(MethodTree methodTree)booleanmatches(NewClassTree newClassTree)MethodMatchers.ParametersBuildername(Predicate<String> namePredicate)Match the name matching the predicate.MethodMatchers.ParametersBuildernames(String... names)Match a method with any name is the list.MethodMatchers.NameBuilderofAnyType()Match any type.MethodMatchers.NameBuilderofSubTypes(String... fullyQualifiedTypeNames)Match any of the type and sub-type of the fully qualified names.MethodMatchers.NameBuilderofType(Predicate<Type> typePredicate)Match a type matching a predicate.MethodMatchers.NameBuilderofTypes(String... fullyQualifiedTypeNames)Match any of the fully qualified name types, but not the subtype.MethodMatchers.ParametersBuilderwithAnyParameters()Match a method signature with any number of parameters of any types.
-
-
-
Method Detail
-
ofSubTypes
public MethodMatchers.NameBuilder ofSubTypes(String... fullyQualifiedTypeNames)
Description copied from interface:MethodMatchers.TypeBuilderMatch any of the type and sub-type of the fully qualified names.- Specified by:
ofSubTypesin interfaceMethodMatchers.TypeBuilder
-
ofAnyType
public MethodMatchers.NameBuilder ofAnyType()
Description copied from interface:MethodMatchers.TypeBuilderMatch any type.- Specified by:
ofAnyTypein interfaceMethodMatchers.TypeBuilder
-
ofTypes
public MethodMatchers.NameBuilder ofTypes(String... fullyQualifiedTypeNames)
Description copied from interface:MethodMatchers.TypeBuilderMatch any of the fully qualified name types, but not the subtype.- Specified by:
ofTypesin interfaceMethodMatchers.TypeBuilder
-
ofType
public MethodMatchers.NameBuilder ofType(Predicate<Type> typePredicate)
Description copied from interface:MethodMatchers.TypeBuilderMatch a type matching a predicate.- Specified by:
ofTypein interfaceMethodMatchers.TypeBuilder
-
names
public MethodMatchers.ParametersBuilder names(String... names)
Description copied from interface:MethodMatchers.NameBuilderMatch a method with any name is the list.- Specified by:
namesin interfaceMethodMatchers.NameBuilder
-
anyName
public MethodMatchers.ParametersBuilder anyName()
Description copied from interface:MethodMatchers.NameBuilderMatch a method with any name. Equivalent to .name(n -> true).- Specified by:
anyNamein interfaceMethodMatchers.NameBuilder
-
constructor
public MethodMatchers.ParametersBuilder constructor()
Description copied from interface:MethodMatchers.NameBuilderMatch a constructor. Equivalent to .name(n -> "".equals(n)) - Specified by:
constructorin interfaceMethodMatchers.NameBuilder
-
name
public MethodMatchers.ParametersBuilder name(Predicate<String> namePredicate)
Description copied from interface:MethodMatchers.NameBuilderMatch the name matching the predicate.- Specified by:
namein interfaceMethodMatchers.NameBuilder
-
addParametersMatcher
public MethodMatchers.ParametersBuilder addParametersMatcher(String... parametersType)
Description copied from interface:MethodMatchers.ParametersBuilderMatch a method signature with exactly the types provided. Others method adding parameters matcher can be called to match multiples signatures.- Specified by:
addParametersMatcherin interfaceMethodMatchers.ParametersBuilder
-
addWithoutParametersMatcher
public MethodMatchers.ParametersBuilder addWithoutParametersMatcher()
Description copied from interface:MethodMatchers.ParametersBuilderMatch a method signature without parameters. Others method adding parameters matcher can be called to match multiples signatures.- Specified by:
addWithoutParametersMatcherin interfaceMethodMatchers.ParametersBuilder
-
withAnyParameters
public MethodMatchers.ParametersBuilder withAnyParameters()
Description copied from interface:MethodMatchers.ParametersBuilderMatch 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:
withAnyParametersin interfaceMethodMatchers.ParametersBuilder
-
addParametersMatcher
public MethodMatchers.ParametersBuilder addParametersMatcher(Predicate<List<Type>> parametersPredicate)
Description copied from interface:MethodMatchers.ParametersBuilderMatch a method signature respecting the predicate. Others method adding parameters matcher can be called to match multiples signatures.- Specified by:
addParametersMatcherin interfaceMethodMatchers.ParametersBuilder
-
matches
public boolean matches(NewClassTree newClassTree)
- Specified by:
matchesin interfaceMethodMatchers
-
matches
public boolean matches(MethodInvocationTree mit)
- Specified by:
matchesin interfaceMethodMatchers
-
matches
public boolean matches(MethodTree methodTree)
- Specified by:
matchesin interfaceMethodMatchers
-
matches
public boolean matches(MethodReferenceTree methodReferenceTree)
- Specified by:
matchesin interfaceMethodMatchers
-
matches
public boolean matches(Symbol symbol)
- Specified by:
matchesin interfaceMethodMatchers
-
build
public MethodMatchers build()
Description copied from interface:MethodMatchers.ParametersBuilderBuild a MethodMatchers. Throw an Exception if the MethodMatchers is not correctly setup (no parameters list defined).- Specified by:
buildin interfaceMethodMatchers.ParametersBuilder
-
-