Class AnnotationMatcher
- java.lang.Object
-
- org.openrewrite.java.AnnotationMatcher
-
public class AnnotationMatcher extends java.lang.ObjectThis matcher will find all annotations matching the annotation patternThe annotation pattern, expressed as a method pattern, is used to find matching annotations. The format of the expression is as follows:
@#annotationClass#(#parameterName#=#parameterValue#, #parameterName#=#parameterValue#...)
- The annotationClass must be fully qualified.
- The parameter name/value pairs can be in any order
EXAMPLES:
@java.lang.SuppressWarnings - Matches java.lang.SuppressWarnings with no parameters. @myhttp.Get(serviceName="payments", path="recentPayments") - Matches references to myhttp.Get where the parameters are also matched. @myhttp.Get(path="recentPayments", serviceName="payments") - Exaclty the same results from the previous example, order of parameters does not matter. @java.lang.SuppressWarnings("deprecation") - Matches java.langSupressWarning with a single parameter. @org.junit.runner.RunWith(org.junit.runners.JUnit4.class) - Matches JUnit4's @RunWith(JUnit4.class)
-
-
Constructor Summary
Constructors Constructor Description AnnotationMatcher(java.lang.String signature)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetAnnotationName()booleanmatches(J.Annotation annotation)
-
-
-
Method Detail
-
matches
public boolean matches(J.Annotation annotation)
-
getAnnotationName
public java.lang.String getAnnotationName()
-
-