@Override public Set<Annotation> getStereotypeDefinition(Class<? extends Annotation> stereotype) { return delegate().getStereotypeDefinition(stereotype); }
private static boolean isAnnotationPresentOnStereotype(Collection<Annotation> annotations, Class<? extends Annotation> annotationType, BeanManager beanManager) { for (Annotation candidate : annotations) { if (beanManager.isStereotype(candidate.annotationType())) { for (Annotation stereotyped : beanManager.getStereotypeDefinition(candidate.annotationType())) { if (stereotyped.annotationType().equals(annotationType)) { return true; } } } } return false; }
@Override public Set<Annotation> getStereotypeDefinition(Class<? extends Annotation> stereotype) { return delegate().getStereotypeDefinition(stereotype); }
@Override public Set<Annotation> getStereotypeDefinition(Class<? extends Annotation> stereotype) { return delegate().getStereotypeDefinition(stereotype); }
private static boolean isAnnotationPresentOnStereotype(Collection<Annotation> annotations, Class<? extends Annotation> annotationType, BeanManager beanManager) { for (Annotation candidate : annotations) { if (beanManager.isStereotype(candidate.annotationType())) { for (Annotation stereotyped : beanManager.getStereotypeDefinition(candidate.annotationType())) { if (stereotyped.annotationType().equals(annotationType)) { return true; } } } } return false; }
private static <A extends Annotation> A getAnnotationFromStereotype(Collection<Annotation> annotations, Class<A> annotationType, BeanManager beanManager) { for (Annotation candidate : annotations) { if (beanManager.isStereotype(candidate.annotationType())) { for (Annotation stereotyped : beanManager.getStereotypeDefinition(candidate.annotationType())) { if (stereotyped.annotationType().equals(annotationType)) { return annotationType.cast(stereotyped); } } } } return null; } }
@Override public Set<Annotation> getStereotypeDefinition(Class<? extends Annotation> stereotype) { return delegate().getStereotypeDefinition(stereotype); }
@Override public Set<Annotation> getStereotypeDefinition(Class<? extends Annotation> stereotype) { return delegate().getStereotypeDefinition(stereotype); }
private static <A extends Annotation> A getAnnotationFromStereotype(Collection<Annotation> annotations, Class<A> annotationType, BeanManager beanManager) { for (Annotation candidate : annotations) { if (beanManager.isStereotype(candidate.annotationType())) { for (Annotation stereotyped : beanManager.getStereotypeDefinition(candidate.annotationType())) { if (stereotyped.annotationType().equals(annotationType)) { return annotationType.cast(stereotyped); } } } } return null; } }
@Override public Set<Annotation> getStereotypeDefinition(Class<? extends Annotation> stereotype) { return delegate().getStereotypeDefinition(stereotype); }
private static <A extends Annotation> A getAnnotationFromStereotype(Collection<Annotation> annotations, Class<A> annotationType, BeanManager beanManager) { for (Annotation candidate : annotations) { if (beanManager.isStereotype(candidate.annotationType())) { for (Annotation stereotyped : beanManager.getStereotypeDefinition(candidate.annotationType())) { if (stereotyped.annotationType().equals(annotationType)) { return annotationType.cast(stereotyped); } } } } return null; } }
private static boolean isAnnotationPresentOnStereotype(Collection<Annotation> annotations, Class<? extends Annotation> annotationType, BeanManager beanManager) { for (Annotation candidate : annotations) { if (beanManager.isStereotype(candidate.annotationType())) { for (Annotation stereotyped : beanManager.getStereotypeDefinition(candidate.annotationType())) { if (stereotyped.annotationType().equals(annotationType)) { return true; } } } } return false; }
private Transactional getTransactionalAnnotationRecursive(Annotation... annotationsOnMember) { if(annotationsOnMember == null) return null; Set<Class<? extends Annotation>> stereotypeAnnotations = new HashSet<>(); for(Annotation annotation: annotationsOnMember) { if(annotation.annotationType().equals(Transactional.class)) { return (Transactional) annotation; } if (beanManager.isStereotype(annotation.annotationType())) { stereotypeAnnotations.add(annotation.annotationType()); } } for(Class<? extends Annotation> stereotypeAnnotation: stereotypeAnnotations) { return getTransactionalAnnotationRecursive(beanManager.getStereotypeDefinition(stereotypeAnnotation)); } return null; }
private Transactional getTransactionalAnnotationRecursive(Annotation... annotationsOnMember) { if(annotationsOnMember == null) return null; Set<Class<? extends Annotation>> stereotypeAnnotations = new HashSet<>(); for(Annotation annotation: annotationsOnMember) { if(annotation.annotationType().equals(Transactional.class)) { return (Transactional) annotation; } if (beanManager.isStereotype(annotation.annotationType())) { stereotypeAnnotations.add(annotation.annotationType()); } } for(Class<? extends Annotation> stereotypeAnnotation: stereotypeAnnotations) { return getTransactionalAnnotationRecursive(beanManager.getStereotypeDefinition(stereotypeAnnotation)); } return null; }
private Transactional getTransactionalAnnotationRecursive(Annotation... annotationsOnMember) { if(annotationsOnMember == null) return null; Set<Class<? extends Annotation>> stereotypeAnnotations = new HashSet<>(); for(Annotation annotation: annotationsOnMember) { if(annotation.annotationType().equals(Transactional.class)) { return (Transactional) annotation; } if (beanManager.isStereotype(annotation.annotationType())) { stereotypeAnnotations.add(annotation.annotationType()); } } for(Class<? extends Annotation> stereotypeAnnotation: stereotypeAnnotations) { return getTransactionalAnnotationRecursive(beanManager.getStereotypeDefinition(stereotypeAnnotation)); } return null; }
public static <A extends Annotation> Optional<A> getAnnotation(BeanManager beanManager, Class<?> annotatedClass, Class<A> annotationType) { if (annotatedClass.isAnnotationPresent(annotationType)) { return Optional.of(annotatedClass.getAnnotation(annotationType)); } Queue<Annotation> annotations = new LinkedList<>(asList(annotatedClass.getAnnotations())); while (!annotations.isEmpty()) { Annotation annotation = annotations.remove(); if (annotation.annotationType().equals(annotationType)) { return Optional.of(annotationType.cast(annotation)); } if (beanManager.isStereotype(annotation.annotationType())) { annotations.addAll( beanManager.getStereotypeDefinition( annotation.annotationType() ) ); } } return empty(); }
public static <A extends Annotation> Optional<A> getAnnotation(BeanManager beanManager, Class<?> annotatedClass, Class<A> annotationType) { if (annotatedClass.isAnnotationPresent(annotationType)) { return Optional.of(annotatedClass.getAnnotation(annotationType)); } Queue<Annotation> annotations = new LinkedList<>(asList(annotatedClass.getAnnotations())); while (!annotations.isEmpty()) { Annotation annotation = annotations.remove(); if (annotation.annotationType().equals(annotationType)) { return Optional.of(annotationType.cast(annotation)); } if (beanManager.isStereotype(annotation.annotationType())) { annotations.addAll( beanManager.getStereotypeDefinition( annotation.annotationType() ) ); } } return empty(); }
public static <A extends Annotation> Optional<A> getAnnotation(BeanManager beanManager, Class<?> annotatedClass, Class<A> annotationType) { if (annotatedClass.isAnnotationPresent(annotationType)) { return Optional.of(annotatedClass.getAnnotation(annotationType)); } Queue<Annotation> annotations = new LinkedList<>(asList(annotatedClass.getAnnotations())); while (!annotations.isEmpty()) { Annotation annotation = annotations.remove(); if (annotation.annotationType().equals(annotationType)) { return Optional.of(annotationType.cast(annotation)); } if (beanManager.isStereotype(annotation.annotationType())) { annotations.addAll( beanManager.getStereotypeDefinition( annotation.annotationType() ) ); } } return empty(); }
private Transactional getTransactionalAnnotationRecursive(Annotation... annotationsOnMember) { if(annotationsOnMember == null) return null; Set<Class<? extends Annotation>> stereotypeAnnotations = new HashSet<>(); for(Annotation annotation: annotationsOnMember) { if(annotation.annotationType().equals(Transactional.class)) { return (Transactional) annotation; } if (beanManager.isStereotype(annotation.annotationType())) { stereotypeAnnotations.add(annotation.annotationType()); } } for(Class<? extends Annotation> stereotypeAnnotation: stereotypeAnnotations) { return getTransactionalAnnotationRecursive(beanManager.getStereotypeDefinition(stereotypeAnnotation)); } return null; }
public static <A extends Annotation> Optional<A> getAnnotation(BeanManager beanManager, Annotated annotated, Class<A> annotationType) { annotated.getAnnotation(annotationType); if (annotated.getAnnotations().isEmpty()) { return empty(); } if (annotated.isAnnotationPresent(annotationType)) { return Optional.of(annotated.getAnnotation(annotationType)); } Queue<Annotation> annotations = new LinkedList<>(annotated.getAnnotations()); while (!annotations.isEmpty()) { Annotation annotation = annotations.remove(); if (annotation.annotationType().equals(annotationType)) { return Optional.of(annotationType.cast(annotation)); } if (beanManager.isStereotype(annotation.annotationType())) { annotations.addAll( beanManager.getStereotypeDefinition( annotation.annotationType() ) ); } } return empty(); }