Example #1
0
 public <A extends java.lang.annotation.Annotation> AnnotationValues<A> getAnnotationValue(
     final Class<A> expectedType) {
   final EclipseNode node = getAnnotation(expectedType);
   return node == null
       ? AnnotationValues.of(expectedType, node())
       : createAnnotation(expectedType, node);
 }
Example #2
0
  public static AnnotationValues<Accessors> getAccessorsForField(JavacNode field) {
    for (JavacNode node : field.down()) {
      if (annotationTypeMatches(Accessors.class, node)) {
        return createAnnotation(Accessors.class, node);
      }
    }

    JavacNode current = field.up();
    while (current != null) {
      for (JavacNode node : current.down()) {
        if (annotationTypeMatches(Accessors.class, node)) {
          return createAnnotation(Accessors.class, node);
        }
      }
      current = current.up();
    }

    return AnnotationValues.of(Accessors.class, field);
  }