private static AnnotationDesc getAnnotation(ProgramElementDoc elementDoc, Class<?> annoClass) { for (AnnotationDesc annoDesc : elementDoc.annotations()) { AnnotationTypeDoc typeDoc = annoDesc.annotationType(); if (typeDoc.typeName().equals(annoClass.getName()) || typeDoc.simpleTypeName().equals(annoClass.getSimpleName())) { return annoDesc; } } return null; }
/** * @return The annotation with the given simple (unqualified) type name, or {@code null} iff the <var>doc</var> is * not annotated with the <var>annotationTypeSimpleName</var> */ @Nullable public static AnnotationDesc get(ProgramElementDoc doc, String annotationTypeSimpleName) { for (AnnotationDesc ad : doc.annotations()) { if (ad.annotationType().simpleTypeName().equals(annotationTypeSimpleName)) return ad; } return null; }
/** * @return The annotation with the given simple (unqualified) type name, or {@code null} iff the <var>doc</var> is * not annotated with the <var>annotationTypeSimpleName</var> */ @Nullable public static AnnotationDesc get(ProgramElementDoc doc, String annotationTypeSimpleName) { for (AnnotationDesc ad : doc.annotations()) { if (ad.annotationType().simpleTypeName().equals(annotationTypeSimpleName)) return ad; } return null; }