public class EntityAnnotationRule extends IssuableSubscriptionVisitor {
@Override public List<Kind> nodesToVisit() { return ImmutableList.of(Kind.CLASS); }
@Override public void visitNode(Tree tree) { ClassTree clazzTree = (ClassTree) tree;
if (checkClazzNamePattern(clazzTree.symbol().name())) { for (AnnotationTree annotationTree : clazzTree.modifiers().annotations()) { reportIssue(annotationTree, "Has Annotation: " + annotationTree.symbolType().name()); } }
}
private boolean checkClazzNamePattern(String name) { return name.contains("SomePattern"); }}
--
Important: this SonarQube Google Group will close on June 11th, 2018, in order to move to a new forum to power even more community discussions. See details in this post: https://groups.google.com/d/msg/sonarqube/BbSZz-JnhVM/DavhMueEAAAJ
---
You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/a677724b-39d2-4f19-8001-45237ed6a4dc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Senior Developer