private static boolean hasAnnotation(final Annotated element, final Set<Class<? extends Annotation>> annotations) { for (final Class<? extends Annotation> a : annotations) { if (element.isAnnotationPresent(a)) { return true; } } return false; }
@Override public ResourceReferenceFactory<Object> registerResourceInjectionPoint(final InjectionPoint injectionPoint) { final String result = getResourceName(injectionPoint); if (isKnownNamespace(result) && injectionPoint.getAnnotated().isAnnotationPresent(Produces.class)) { validateResourceInjectionPointType(getManagedReferenceFactory(getBindInfo(result)), injectionPoint); } return new ResourceReferenceFactory<Object>() { @Override public ResourceReference<Object> createResource() { return new SimpleResourceReference<Object>(resolveResource(injectionPoint)); } }; }
private static boolean hasAnnotation(final Annotated element, final Set<Class<? extends Annotation>> annotations) { for (final Class<? extends Annotation> a : annotations) { if (element.isAnnotationPresent(a)) { return true; } } return false; }
private void addAnnotatedTypeIfNecessary(Annotated annotated) { if (annotated.isAnnotationPresent(Param.class)) { Type type = annotated.getBaseType(); // Skip ParamValue as it is already handled by RequestParameterProducer. if (type instanceof ParameterizedType && ParamValue.class.isAssignableFrom((Class<?>) ((ParameterizedType) type).getRawType())) { return; } types.add(type); } }
/** * Add beans to eager startup beans registry. * * @param event event to process */ public <T> void collect(@Observes ProcessBean<T> event) { if (event.getAnnotated().isAnnotationPresent(Eager.class) && event.getAnnotated().isAnnotationPresent(ApplicationScoped.class)) { this.eagerBeansList.add(event.getBean()); } }
public <T> void collect(@Observes ProcessBean<T> event) { if (event.getAnnotated().isAnnotationPresent(Eager.class) && event.getAnnotated().isAnnotationPresent(ApplicationScoped.class)) { eagerBeansList.add(event.getBean()); } }
<X> void processBean(@Observes ProcessBean<X> event) { if (event.getAnnotated().isAnnotationPresent(Startup.class) && event.getAnnotated().isAnnotationPresent(ApplicationScoped.class)) { startupBeans.add(event.getBean()); } }
public <T> void collect(@Observes ProcessBean<T> event) { if (event.getAnnotated().isAnnotationPresent(Eager.class) && event.getAnnotated().isAnnotationPresent(ApplicationScoped.class)) { eagerBeansList.add(event.getBean()); } } public void load(@Observes AfterDeploymentValidation event, BeanManager beanManager) {
protected boolean isDelegateInjection(CreationalContextImpl<?> cc) { InjectionPoint ip = cc.getInjectionPoint(); if (ip == null) { return false; } return ip.getAnnotated().isAnnotationPresent(Delegate.class); }
@Produces public Logger produceLogger(final InjectionPoint injectionPoint) { final String loggerName; if (injectionPoint.getAnnotated().isAnnotationPresent(NamedLogger.class)) { loggerName = injectionPoint.getAnnotated().getAnnotation(NamedLogger.class).value(); } else { loggerName = injectionPoint.getMember().getDeclaringClass().getName(); } return LoggerFactory.getLogger(loggerName); }
private void addAnnotatedTypeIfNecessary(Annotated annotated) { if (annotated.isAnnotationPresent(ManagedProperty.class)) { Type type = annotated.getBaseType(); types.add(new ManagedPropertyInfo(type, annotated.getAnnotation(ManagedProperty.class).value())); } }
public void observeEmbeddedCacheManagerBean(ProcessBean<?> processBean) { if (processBean.getBean().getTypes().contains(EmbeddedCacheManager.class) && !processBean.getAnnotated().isAnnotationPresent(DefaultBean.class)) { // Install any non-default EmbeddedCacheManager producers. We handle default ones separately, to ensure we only pick them up if installed installedEmbeddedCacheManagers.add(processBean.getBean().getQualifiers()); } }
public Object redefineParameterValue(ParameterValue value) { if (value.getInjectionPoint().getAnnotated().isAnnotationPresent(Observes.class)) { return event; } else { return value.getDefaultValue(creationalContext); } } });
public Object redefineParameterValue(ParameterValue value) { if (value.getInjectionPoint().getAnnotated().isAnnotationPresent(Observes.class)) { return event; } else { return value.getDefaultValue(creationalContext); } } });
private boolean isInjectionPointPassivationCapable(InjectionPoint ij, Bean<?> resolvedBean, BeanManagerImpl beanManager) { if (!Beans.isPassivationCapableDependency(resolvedBean)) { if (((ij.getMember() instanceof Field) && ij.isTransient())) { return true; } if (ij.getAnnotated() instanceof AnnotatedParameter<?> && ij.getAnnotated().isAnnotationPresent(TransientReference.class)) { return true; } return false; } return true; }
private boolean isInjectionPointPassivationCapable(InjectionPoint ij, Bean<?> resolvedBean, BeanManagerImpl beanManager) { if (!Beans.isPassivationCapableDependency(resolvedBean)) { if (((ij.getMember() instanceof Field) && ij.isTransient())) { return true; } if (ij.getAnnotated() instanceof AnnotatedParameter<?> && ij.getAnnotated().isAnnotationPresent(TransientReference.class)) { return true; } return false; } return true; }
private boolean isInjectionPointPassivationCapable(InjectionPoint ij, Bean<?> resolvedBean, BeanManagerImpl beanManager) { if (!Beans.isPassivationCapableDependency(resolvedBean)) { if (((ij.getMember() instanceof Field) && ij.isTransient())) { return true; } if (ij.getAnnotated() instanceof AnnotatedParameter<?> && ij.getAnnotated().isAnnotationPresent(TransientReference.class)) { return true; } return false; } return true; }
private boolean isInjectionPointPassivationCapable(InjectionPoint ij, Bean<?> resolvedBean, BeanManagerImpl beanManager) { if (!Beans.isPassivationCapableDependency(resolvedBean)) { if (((ij.getMember() instanceof Field) && ij.isTransient())) { return true; } if (ij.getAnnotated() instanceof AnnotatedParameter<?> && ij.getAnnotated().isAnnotationPresent(TransientReference.class)) { return true; } return false; } return true; }
private boolean isInjectionPointPassivationCapable(InjectionPoint ij, Bean<?> resolvedBean, BeanManagerImpl beanManager) { if (!Beans.isPassivationCapableDependency(resolvedBean)) { if (((ij.getMember() instanceof Field) && ij.isTransient())) { return true; } if (ij.getAnnotated() instanceof AnnotatedParameter<?> && ij.getAnnotated().isAnnotationPresent(TransientReference.class)) { return true; } return false; } return true; }
@Produces @TypedMessageBundle Object produceTypedMessageBundle(InjectionPoint injectionPoint) { Annotated annotated = injectionPoint.getAnnotated(); if (annotated.isAnnotationPresent(Locale.class)) { return getBundle(getRawType(injectionPoint.getType()), toLocale(annotated.getAnnotation(Locale.class).value())); } else { return getBundle(getRawType(injectionPoint.getType())); } }