public InterceptorComparator(WebBeansContext webBeansContext) { interceptorsManager = webBeansContext.getInterceptorsManager(); }
@Override public boolean isInterceptorEnabled() { return webBeansContext.getInterceptorsManager().isInterceptorClassEnabled(annotatedType.getJavaClass()); }
/** * Returns true if the annotation is defined in xml or annotated with * {@link javax.interceptor.InterceptorBinding} or an InterceptorBinding * registered via {@link javax.enterprise.inject.spi.BeforeBeanDiscovery}. * False otherwise. * * @param clazz type of the annotation * @return true if the annotation is defined in xml or annotated with * {@link javax.interceptor.InterceptorBinding}, false otherwise */ public boolean isInterceptorBindingAnnotation(Class<? extends Annotation> clazz) { Asserts.nullCheckForClass(clazz); return clazz.isAnnotationPresent(InterceptorBinding.class) || webBeansContext.getInterceptorsManager().hasInterceptorBindingType(clazz); }
/** * {@inheritDoc} */ @Override public void addInterceptorBinding(AnnotatedType<? extends Annotation> annotatedType) { checkState(); // TODO extract inherited types webBeansContext.getInterceptorsManager().addInterceptorBindingType(annotatedType); }
/** * {@inheritDoc} */ @Override public void addInterceptorBinding(Class<? extends Annotation> binding, Annotation... bindingDef) { checkState(); webBeansContext.getInterceptorsManager().addInterceptorBindingType(binding, bindingDef); }
/** * {@inheritDoc} */ @Override public List<Interceptor<?>> resolveInterceptors(InterceptionType type, Annotation... interceptorBindings) { webBeansContext.getAnnotationManager().checkInterceptorResolverParams(interceptorBindings); return webBeansContext.getInterceptorsManager().resolveInterceptors(type, interceptorBindings); }
private void collectEjbInterceptors(List<Interceptor<?>> ejbInterceptors, Annotated annotated, boolean unproxyable, Set<Type> types) { Interceptors interceptorsAnnot = annotated.getAnnotation(Interceptors.class); if (interceptorsAnnot != null) { if (unproxyable) { throw new WebBeansConfigurationException(annotated + " is not proxyable, but an Interceptor got defined on it!"); } if (types == null) { types = Collections.emptySet(); } for (Class interceptorClass : interceptorsAnnot.value()) { if (types.contains(interceptorClass)) // don't create another bean for it { continue; } Interceptor ejbInterceptor = webBeansContext.getInterceptorsManager().getEjbInterceptorForClass(interceptorClass); ejbInterceptors.add(ejbInterceptor); } } }
public void clear() { additionalAnnotatedTypes.clear(); additionalQualifiers.clear(); additionalScopes.clear(); scopeAnnotations.clear(); nonscopeAnnotations.clear(); clearCacheProxies(); singleContextMap.clear(); contextMap.clear(); deploymentBeans.clear(); errorStack.clear(); producersForJavaEeComponents.clear(); passivationBeans.clear(); webBeansContext.getInterceptorsManager().clear(); webBeansContext.getDecoratorsManager().clear(); webBeansContext.getAnnotatedElementFactory().clear(); injectionResolver.clearCaches(); webBeansContext.getAnnotationManager().clearCaches(); // finally destroy all SPI services webBeansContext.clear(); }
/** * Return true if this annotated type represents a decorator. * @param annotatedType annotated type * @return true if decorator */ public boolean isAnnotatedTypeDecoratorOrInterceptor(AnnotatedType<?> annotatedType) { if(isDecorator(annotatedType) || isCdiInterceptor(annotatedType)) { return true; } else if(webBeansContext.getInterceptorsManager().isInterceptorClassEnabled(annotatedType.getJavaClass())) { return true; } else if(webBeansContext.getDecoratorsManager().isDecoratorEnabled(annotatedType.getJavaClass())) { return true; } return false; }
webBeansContext.getInterceptorsManager().addInterceptorBindingType(Transactional.class);
final InterceptorsManager interceptorsManager = webBeansContext.getInterceptorsManager();
/** * Creates a new deployer with given xml configurator. * * @param webBeansContext */ public BeansDeployer(WebBeansContext webBeansContext) { this.webBeansContext = webBeansContext; beanArchiveService = webBeansContext.getBeanArchiveService(); scannerService = webBeansContext.getScannerService(); decoratorsManager = webBeansContext.getDecoratorsManager(); interceptorsManager = webBeansContext.getInterceptorsManager(); String usage = this.webBeansContext.getOpenWebBeansConfiguration().getProperty(OpenWebBeansConfiguration.USE_EJB_DISCOVERY); discoverEjb = Boolean.parseBoolean(usage); defaultBeanArchiveInformation = new DefaultBeanArchiveInformation("default"); defaultBeanArchiveInformation.setBeanDiscoveryMode(BeanDiscoveryMode.ALL); }
final AlternativesManager alternativesManager = webBeansContext.getAlternativesManager(); final DecoratorsManager decoratorsManager = webBeansContext.getDecoratorsManager(); final InterceptorsManager interceptorsManager = webBeansContext.getInterceptorsManager();
InterceptorsManager interceptorsManager = webBeansContext.getInterceptorsManager(); interceptorsManager.addCdiInterceptor(interceptor); interceptorsManager.addCustomInterceptorClass(bean.getBeanClass());
webBeansContext.getInterceptorsManager().addCdiInterceptor(interceptor);
/** * Fires event before bean discovery. */ private void fireBeforeBeanDiscoveryEvent() { BeanManagerImpl manager = webBeansContext.getBeanManagerImpl(); BeforeBeanDiscoveryImpl event = new BeforeBeanDiscoveryImpl(webBeansContext); manager.fireLifecycleEvent(event); for (AnnotatedTypeConfiguratorHolder holder : event.getAnnotatedTypeConfigurators()) { manager.addAdditionalAnnotatedType( holder.getExtension(), holder.getAnnotatedTypeConfigurator().getNewAnnotatedType(), holder.getId()); } for (AnnotatedTypeConfiguratorImpl<?> interceptorATC : event.getInterceptorBindingConfigurators()) { webBeansContext.getInterceptorsManager().addInterceptorBindingType((AnnotatedType) interceptorATC.getNewAnnotatedType()); } for (AnnotatedTypeConfiguratorImpl<?> qualifierAt : event.getQualifierConfigurators()) { webBeansContext.getBeanManagerImpl().addAdditionalQualifier((AnnotatedType) qualifierAt.getNewAnnotatedType()); } event.setStarted(); }
private void customizeContext(final WebBeansContext instance) { final BeanManagerImpl beanManager = instance.getBeanManagerImpl(); final InterceptorsManager interceptorsManager = instance.getInterceptorsManager(); beanManager.addInternalBean(newBean(instance, configurator -> configurator.beanClass(Meecrowave.Builder.class) .scope(ApplicationScoped.class) .qualifiers(DefaultLiteral.INSTANCE) .types(Meecrowave.Builder.class, Object.class) .createWith(cc -> meecrowave.getConfiguration()))); beanManager.addInternalBean(newBean(instance, configurator -> configurator.beanClass(Meecrowave.class) .scope(ApplicationScoped.class) .qualifiers(DefaultLiteral.INSTANCE) .types(Meecrowave.class, AutoCloseable.class, Object.class) .createWith(cc -> meecrowave))); if (Cxfs.IS_PRESENT) { interceptorsManager.addInterceptorBindingType(JAXRSFieldInjectionInterceptor.Binding.class); beanManager.addAdditionalAnnotatedType(this, beanManager.createAnnotatedType(JAXRSFieldInjectionInterceptor.class)); } }
private void customizeContext(final WebBeansContext instance) { final BeanManagerImpl beanManager = instance.getBeanManagerImpl(); final InterceptorsManager interceptorsManager = instance.getInterceptorsManager(); beanManager.addInternalBean(newBean(instance, configurator -> configurator.beanClass(Meecrowave.Builder.class) .scope(ApplicationScoped.class) .qualifiers(DefaultLiteral.INSTANCE) .types(Meecrowave.Builder.class, Object.class) .createWith(cc -> meecrowave.getConfiguration()))); beanManager.addInternalBean(newBean(instance, configurator -> configurator.beanClass(Meecrowave.class) .scope(ApplicationScoped.class) .qualifiers(DefaultLiteral.INSTANCE) .types(Meecrowave.class, AutoCloseable.class, Object.class) .createWith(cc -> meecrowave))); if (Cxfs.IS_PRESENT) { interceptorsManager.addInterceptorBindingType(JAXRSFieldInjectionInterceptor.Binding.class); beanManager.addAdditionalAnnotatedType(this, beanManager.createAnnotatedType(JAXRSFieldInjectionInterceptor.class)); } }