@Override public Annotation[] getAnnotations() { return annotated.getAnnotations(); }
public static List<Annotation> extractQualifiers(final HasAnnotations annotated) { final List<Annotation> qualifiers = new ArrayList<Annotation>(); for (final Annotation anno : annotated.getAnnotations()) { if (anno.annotationType().isAnnotationPresent(Qualifier.class)) { qualifiers.add(anno); } } return qualifiers; }
protected Collection<Annotation> getQualifiers(final HasAnnotations injectedType) { final Collection<Annotation> annos = new ArrayList<>(); for (final Annotation anno : injectedType.getAnnotations()) { if (anno.annotationType().isAnnotationPresent(Qualifier.class)) { annos.add(anno); } } return annos; }
@SuppressWarnings("unchecked") public default <A extends Annotation> A getAnnotation(final Class<A> annotation) { // Please no hate or else null. return (A) Arrays.stream(getAnnotations()) .filter(a -> a.annotationType().equals(annotation)) .findFirst() .orElse(null); } }
@SuppressWarnings("unchecked") public default <A extends Annotation> A getAnnotation(final Class<A> annotation) { // Please no hate or else null. return (A) Arrays.stream(getAnnotations()) .filter(a -> a.annotationType().equals(annotation)) .findFirst() .orElse(null); } }
@Override public Annotation[] getAnnotations() { return getAnnotated().getAnnotations(); }
public Annotation getMatchingAnnotationForElementType(final WiringElementType type, final HasAnnotations hasAnnotations) { final Collection<Class<? extends Annotation>> annotationsForElementType = getAnnotationsForElementType(type); for (final Annotation a : hasAnnotations.getAnnotations()) { if (annotationsForElementType.contains(a.annotationType())) { return a; } } final Set<Annotation> annotationSet = new HashSet<Annotation>(); fillInStereotypes(annotationSet, hasAnnotations.getAnnotations(), false); for (final Annotation a : annotationSet) { if (annotationsForElementType.contains(a.annotationType())) { return a; } } return null; }
private SortedSet<AnnotationWrapper> getRawQualifiers(final HasAnnotations annotated) { final SortedSet<AnnotationWrapper> annos = new TreeSet<>(); for (final Annotation anno : annotated.getAnnotations()) { if (anno.annotationType().isAnnotationPresent(javax.inject.Qualifier.class)) { if (anno.annotationType().equals(Named.class) && ((Named) anno).value().equals("")) { annos.add(createNamed(annotated)); } else { annos.add(new AnnotationWrapper(anno)); } } else if (anno.annotationType().isAnnotationPresent(Stereotype.class)) { annos.addAll(getRawQualifiers(MetaClassFactory.get(anno.annotationType()))); } } return annos; }
}); for (final Annotation anno : annotated.getAnnotations()) { final Class<? extends Annotation> annoType = anno.annotationType(); if (scopeAnnoTypes.contains(annoType)) {