private static boolean hasAnnotation(ModifiersTree modifiers, String annotationName) {
   for (AnnotationTree annotation : modifiers.annotations()) {
     if (annotation.symbolType().is(annotationName)) {
       return true;
     }
   }
   return false;
 }
Exemplo n.º 2
0
 @Nullable
 public static String getApiJavadoc(Tree tree) {
   if (!tree.is(API_KINDS)) {
     return null;
   }
   ModifiersTree modifiersTree = getModifierTrees(tree);
   // FIXME token should be retrieved in a much simpler way.
   if (modifiersTree != null
       && !(modifiersTree.modifiers().isEmpty() && modifiersTree.annotations().isEmpty())) {
     return getCommentFromTree(modifiersTree);
   }
   if (tree.is(Tree.Kind.METHOD)) {
     MethodTree methodTree = (MethodTree) tree;
     return getCommentFromMethod(methodTree);
   }
   return getCommentFromTree(tree);
 }
Exemplo n.º 3
0
 public boolean isAnnotatedOverride() {
   for (AnnotationTree annotationTree : modifiers.annotations()) {
     if (annotationTree.annotationType().is(Tree.Kind.IDENTIFIER)) {
       IdentifierTree identifier = (IdentifierTree) annotationTree.annotationType();
       if (Override.class.getSimpleName().equals(identifier.name())) {
         return true;
       }
     }
   }
   return false;
 }