@Override public <T extends Annotation> T getAnnotation(final Class<T> annotationType) { return annotatedType.getAnnotation(annotationType); }
/** * Gets the annotation. * * @param annotationType Annotation type. * @param <R> Annotation type param. * @return Annotation instance. */ @SuppressWarnings("unchecked") public <R extends Annotation> R getAnnotation(Class<R> annotationType) { if (CommandBinding.class.equals(annotationType)) { return (R) LiteralCommandBinding.getInstance(); } return delegate.getAnnotation(annotationType); }
Interceptor annot = type.getAnnotation(Interceptor.class); if (annot != null) { return;
public <T extends Annotation> T getAnnotation(Class<T> annotationType) { return delegate.getAnnotation(annotationType); }
@Override public <A extends Annotation> A getAnnotation(Class<A> annotationType) { return wrappedType.getAnnotation( annotationType ); }
@Override public <A extends Annotation> A getAnnotation(Class<A> annotationType) { if (annotationType == Vetoed.class) { return null; } return annotatedType.getAnnotation(annotationType); }
@Override @SuppressWarnings("unchecked") public <T extends Annotation> T getAnnotation(Class<T> annotationType) { for (Annotation a : annotationSet) { if (annotationType == a.annotationType()) { return (T)a; } } return null; }
@Override @SuppressWarnings("unchecked") public <T extends Annotation> T getAnnotation(Class<T> annotationType) { for (Annotation a : annotationSet) { if (annotationType == a.annotationType()) { return (T)a; } } return null; }
@Override public <A extends Annotation> A getAnnotation(Class<A> annotationType) { if (annotationType == Vetoed.class) { return null; } return annotatedType.getAnnotation(annotationType); }
@Override public boolean isAnnotationPresent(Class<? extends Annotation> annotationType) { return getAnnotation(annotationType) != null; } }
public SecurityFactory(AspectBeanFactory<X> beanFactory, AspectFactory<X> next) { super(beanFactory, next); _classRunAs = beanFactory.getBeanType().getAnnotation(RunAs.class); _classRolesAllowed = beanFactory.getBeanType().getAnnotation(RolesAllowed.class); _classPermitAll = beanFactory.getBeanType().getAnnotation(PermitAll.class); _classDenyAll = beanFactory.getBeanType().getAnnotation(DenyAll.class); }
@Override public boolean isAnnotationPresent(Class<? extends Annotation> annotationType) { return getAnnotation(annotationType) != null; } }
@Test @SpecAssertion(section = "11.4", id = "e") public void testGetAnnotation() { AnnotatedType<?> annotatedType = getCurrentManager().createAnnotatedType(ClassD.class); assert annotatedType.getAnnotation(RequestScoped.class) != null; assert annotatedType.getAnnotation(ApplicationScoped.class) == null; }
/** * @return true if the AnnotatedType is an enabled Alternative or no alternative at all */ private boolean isEnabled(AnnotatedType<?> annotatedType) { return annotatedType.getAnnotation(Alternative.class) == null || alternativesManager.isAlternative(annotatedType.getJavaClass(), getAnnotationClasses(annotatedType)); }
<T> void processAnnotatedType(@Observes ProcessAnnotatedType<T> event, BeanManager beanManager) { FacesConfig facesConfig = event.getAnnotatedType().getAnnotation(FacesConfig.class); if (facesConfig != null && facesConfig.version() == FacesConfig.Version.JSF_2_3) { registerCdiProducers = true; } }
<T> void processAnnotatedType(@Observes @WithAnnotations(EnableSnoopClient.class) ProcessAnnotatedType<T> pat) { // workaround for WELD bug revealed by JDK8u60 final ProcessAnnotatedType<T> snoopAnnotated = pat; LOGGER.config(() -> "Found @EnableSnoopClient annotated class: " + snoopAnnotated.getAnnotatedType().getJavaClass().getName()); snoopEnabled = true; serviceName = snoopAnnotated.getAnnotatedType().getAnnotation(EnableSnoopClient.class).serviceName(); LOGGER.config(() -> "Snoop Service name is: " + serviceName); } }
<T> void processAnnotatedType(@Observes @WithAnnotations(EnableSnoopClient.class) ProcessAnnotatedType<T> pat) { // workaround for WELD bug revealed by JDK8u60 final ProcessAnnotatedType<T> snoopAnnotated = pat; LOGGER.config(() -> "Found @EnableSnoopClient annotated class: " + snoopAnnotated.getAnnotatedType().getJavaClass().getName()); snoopEnabled = true; serviceName = snoopAnnotated.getAnnotatedType().getAnnotation(EnableSnoopClient.class).serviceName(); LOGGER.config(() -> "Snoop Service name is: " + serviceName); } }
private String getName(final ProcessObserverMethod<?, ?> processObserverMethod) { return ofNullable(processObserverMethod.getAnnotatedMethod().getDeclaringType().getAnnotation(Named.class)) .map(Named::value) .orElseGet(() -> processObserverMethod.getAnnotatedMethod().getJavaMember().getName()); } }
public <T> void processInjectionTarget(@Observes ProcessInjectionTarget<T> event, BeanManager manager) { AnnotatedType<T> at = event.getAnnotatedType(); XmlId xid = at.getAnnotation(XmlId.class); if (xid != null) { log.info("Wrapping InjectionTarget to set field values: " + event.getAnnotatedType().getJavaClass().getName()); List<FieldValueObject> fvs = fieldValues.get(xid.value()); event.setInjectionTarget(new InjectionTargetWrapper<T>(event.getInjectionTarget(), fvs, manager)); } }
<X, T> void registerGenericBeanProducerMethod(@Observes ProcessProducerMethod<X, T> event) { AnnotatedType<X> declaringType = event.getAnnotatedProducerMethod().getDeclaringType(); Annotation genericConfiguration = getGenericConfiguration(event.getAnnotated()); if (declaringType.isAnnotationPresent(GenericConfiguration.class)) { genericBeanProducerMethods.put(declaringType.getAnnotation(GenericConfiguration.class).value(), getProducerMethodHolder(event)); } else if (genericConfiguration != null) { if (validateGenericProducer(genericConfiguration, event.getBean(), event.getAnnotatedProducerMethod())) { genericProducerBeans.put(event.getAnnotatedProducerMethod(), event.getBean()); } } }