/** * Get the Collection of resolved TypeQualifierAnnotations representing * directly applied and default (outer scope) type qualifier annotations for * given AnnotatedObject. * * <p> * NOTE: does not properly account for inherited annotations on instance * methods. It is ok to call this method to find out generally-relevant * TypeQualifierAnnotations, but not to find the effective * TypeQualifierAnnotation. * </p> * * @param o * an AnnotatedObject * @return Collection of TypeQualifierAnnotations applicable to the * AnnotatedObject */ public static Collection<TypeQualifierAnnotation> getApplicableApplications(AnnotatedObject o) { return getApplicableScopedApplications(o, o.getElementType()); }
/** * Get a directly-applied TypeQualifierAnnotation on given AnnotatedObject. * * @param o * an AnnotatedObject * @param typeQualifierValue * the kind of TypeQualifierValue we are looking for * @return directly-applied TypeQualifierAnnotation, or null if there is no * such annotation on the AnnotatedObject */ private static TypeQualifierAnnotation getDirectTypeQualifierAnnotation(AnnotatedObject o, TypeQualifierValue<?> typeQualifierValue) { TypeQualifierAnnotation result; Set<TypeQualifierAnnotation> applications = new HashSet<>(); getDirectApplications(applications, o, o.getElementType()); result = findMatchingTypeQualifierAnnotation(applications, typeQualifierValue); return result; }
/** * Populate a Set of TypeQualifierAnnotations representing directly-applied * type qualifier annotations on given AnnotatedObject. * * @param result * Set of TypeQualifierAnnotations * @param o * an AnnotatedObject * @param e * ElementType representing kind of annotated object */ public static void getDirectApplications(Set<TypeQualifierAnnotation> result, AnnotatedObject o, ElementType e) { if (!o.getElementType().equals(e)) { return; } Collection<AnnotationValue> values = getDirectAnnotation(o); for (AnnotationValue v : values) { constructTypeQualifierAnnotation(result, v); } }
ElementType elementType = o.getElementType(); while (true) { o = o.getContainingScope();
/** * Get the Collection of resolved TypeQualifierAnnotations representing * directly applied and default (outer scope) type qualifier annotations for * given AnnotatedObject. * * <p> * NOTE: does not properly account for inherited annotations on instance * methods. It is ok to call this method to find out generally-relevant * TypeQualifierAnnotations, but not to find the effective * TypeQualifierAnnotation. * </p> * * @param o * an AnnotatedObject * @return Collection of TypeQualifierAnnotations applicable to the * AnnotatedObject */ public static Collection<TypeQualifierAnnotation> getApplicableApplications(AnnotatedObject o) { return getApplicableScopedApplications(o, o.getElementType()); }
/** * Get a directly-applied TypeQualifierAnnotation on given AnnotatedObject. * * @param o * an AnnotatedObject * @param typeQualifierValue * the kind of TypeQualifierValue we are looking for * @return directly-applied TypeQualifierAnnotation, or null if there is no * such annotation on the AnnotatedObject */ private static TypeQualifierAnnotation getDirectTypeQualifierAnnotation(AnnotatedObject o, TypeQualifierValue<?> typeQualifierValue) { TypeQualifierAnnotation result; Set<TypeQualifierAnnotation> applications = new HashSet<TypeQualifierAnnotation>(); getDirectApplications(applications, o, o.getElementType()); result = findMatchingTypeQualifierAnnotation(applications, typeQualifierValue); return result; }
/** * Populate a Set of TypeQualifierAnnotations representing directly-applied * type qualifier annotations on given AnnotatedObject. * * @param result * Set of TypeQualifierAnnotations * @param o * an AnnotatedObject * @param e * ElementType representing kind of annotated object */ public static void getDirectApplications(Set<TypeQualifierAnnotation> result, AnnotatedObject o, ElementType e) { if (!o.getElementType().equals(e)) { return; } Collection<AnnotationValue> values = getDirectAnnotation(o); for (AnnotationValue v : values) { constructTypeQualifierAnnotation(result, v); } }
ElementType elementType = o.getElementType(); while (true) { o = o.getContainingScope();