public static BeanDeployerEnvironment newEnvironment(BeanManagerImpl manager) { return new BeanDeployerEnvironment(manager); }
public void addProducerField(ProducerField<?, ?> bean) { producerFields.add(bean); addAbstractBean(bean); }
public void addManagedBean(ManagedBean<?> bean) { addAbstractClassBean(bean); }
public void processAnnotatedTypes() { Set<SlimAnnotatedTypeContext<?>> classesToBeAdded = new HashSet<SlimAnnotatedTypeContext<?>>(); Set<SlimAnnotatedTypeContext<?>> classesToBeRemoved = new HashSet<SlimAnnotatedTypeContext<?>>(); for (SlimAnnotatedTypeContext<?> annotatedTypeContext : getEnvironment().getAnnotatedTypes()) { SlimAnnotatedType<?> annotatedType = annotatedTypeContext.getAnnotatedType(); final ProcessAnnotatedTypeImpl<?> event = containerLifecycleEvents.fireProcessAnnotatedType(getManager(), annotatedTypeContext); // process the result if (event != null) { if (event.isVeto()) { getEnvironment().vetoJavaClass(annotatedType.getJavaClass()); classesToBeRemoved.add(annotatedTypeContext); } else { boolean dirty = event.isDirty(); if (dirty) { classesToBeRemoved.add(annotatedTypeContext); // remove the original class classesToBeAdded.add(SlimAnnotatedTypeContext.of(event.getResultingAnnotatedType(), annotatedTypeContext.getExtension())); } processPriority(event.getResultingAnnotatedType()); } } else { processPriority(annotatedType); } } getEnvironment().removeAnnotatedTypes(classesToBeRemoved); getEnvironment().addAnnotatedTypes(classesToBeAdded); }
@Override protected void storeSyntheticAnnotatedType(BeanDeployment deployment, AnnotatedType<?> type, String id) { SlimAnnotatedType<?> annotatedType = transformer.getUnbackedAnnotatedType(type, getBeanManager().getId(), id); Extension extension = getReceiver(); SlimAnnotatedTypeContext<?> annotatedTypeContext = SlimAnnotatedTypeContext.of(annotatedType, extension); ProcessAnnotatedTypeImpl<?> event = events.fireProcessAnnotatedType(getBeanManager(), annotatedTypeContext); if (event == null) { deployment.getBeanDeployer().getEnvironment().addAnnotatedType(annotatedTypeContext); store.put(annotatedType); } else if (event.isVeto()) { return; } else { annotatedType = event.getResultingAnnotatedType(); deployment.getBeanDeployer().getEnvironment().addSyntheticAnnotatedType(annotatedType, extension); store.put(annotatedType); } } }
protected <T> void createDecorator(EnhancedAnnotatedType<T> weldClass) { BeanAttributes<T> attributes = BeanAttributesFactory.forBean(weldClass, getManager()); DecoratorImpl<T> bean = DecoratorImpl.of(attributes, weldClass, manager); getEnvironment().addDecorator(bean); }
protected <T> void createInterceptor(EnhancedAnnotatedType<T> weldClass) { BeanAttributes<T> attributes = BeanAttributesFactory.forBean(weldClass, getManager()); InterceptorImpl<T> bean = InterceptorImpl.of(attributes, weldClass, manager); getEnvironment().addInterceptor(bean); }
/** * Loads a given class, creates a {@link SlimAnnotatedTypeContext} for it and stores it in {@link BeanDeployerEnvironment}. */ public BeanDeployer addClass(String className, AnnotatedTypeLoader loader) { SlimAnnotatedTypeContext<?> ctx = loader.loadAnnotatedType(className, getManager().getId()); if (ctx != null) { getEnvironment().addAnnotatedType(ctx); } return this; }
protected <X> void createDisposalMethods(AbstractClassBean<X> declaringBean, EnhancedAnnotatedType<X> annotatedClass) { for (EnhancedAnnotatedMethod<?, ? super X> method : BeanMethods.filterMethods(annotatedClass .getDeclaredEnhancedMethodsWithAnnotatedParameters(Disposes.class))) { DisposalMethod<? super X, ?> disposalBean = DisposalMethod.of(manager, method, declaringBean); getEnvironment().addDisposesMethod(disposalBean); } }
protected void addExtension(ExtensionBean bean) { getEnvironment().addExtension(bean); }
public void addBuiltInBean(AbstractBuiltInBean<?> bean) { getEnvironment().addBuiltInBean(bean); }
public void addSyntheticAnnotatedType(SlimAnnotatedType<?> annotatedType, Extension extension) { addAnnotatedType(SlimAnnotatedTypeContext.of(annotatedType, extension)); }
private <T> SlimAnnotatedTypeContext<T> addIfNotNull(SlimAnnotatedTypeContext<T> ctx) { if (ctx != null) { getEnvironment().addAnnotatedType(ctx); } return ctx; }
public void processAnnotatedTypes() { Set<SlimAnnotatedTypeContext<?>> classesToBeAdded = new HashSet<SlimAnnotatedTypeContext<?>>(); Set<SlimAnnotatedTypeContext<?>> classesToBeRemoved = new HashSet<SlimAnnotatedTypeContext<?>>(); for (SlimAnnotatedTypeContext<?> annotatedTypeContext : getEnvironment().getAnnotatedTypes()) { SlimAnnotatedType<?> annotatedType = annotatedTypeContext.getAnnotatedType(); final ProcessAnnotatedTypeImpl<?> event = containerLifecycleEvents.fireProcessAnnotatedType(getManager(), annotatedTypeContext); // process the result if (event != null) { if (event.isVeto()) { getEnvironment().vetoJavaClass(annotatedType.getJavaClass()); classesToBeRemoved.add(annotatedTypeContext); } else { boolean dirty = event.isDirty(); if (dirty) { classesToBeRemoved.add(annotatedTypeContext); // remove the original class classesToBeAdded.add(SlimAnnotatedTypeContext.of(event.getResultingAnnotatedType(), annotatedTypeContext.getExtension())); } processPriority(event.getResultingAnnotatedType()); } } else { processPriority(annotatedType); } } getEnvironment().removeAnnotatedTypes(classesToBeRemoved); getEnvironment().addAnnotatedTypes(classesToBeAdded); }
@Override protected void storeSyntheticAnnotatedType(BeanDeployment deployment, AnnotatedType<?> type, String id) { SlimAnnotatedType<?> annotatedType = transformer.getUnbackedAnnotatedType(type, getBeanManager().getId(), id); Extension extension = getReceiver(); SlimAnnotatedTypeContext<?> annotatedTypeContext = SlimAnnotatedTypeContext.of(annotatedType, extension); ProcessAnnotatedTypeImpl<?> event = events.fireProcessAnnotatedType(getBeanManager(), annotatedTypeContext); if (event == null) { deployment.getBeanDeployer().getEnvironment().addAnnotatedType(annotatedTypeContext); store.put(annotatedType); } else if (event.isVeto()) { return; } else { annotatedType = event.getResultingAnnotatedType(); deployment.getBeanDeployer().getEnvironment().addSyntheticAnnotatedType(annotatedType, extension); store.put(annotatedType); } } }
protected <T> void createDecorator(EnhancedAnnotatedType<T> weldClass) { BeanAttributes<T> attributes = BeanAttributesFactory.forBean(weldClass, getManager()); DecoratorImpl<T> bean = DecoratorImpl.of(attributes, weldClass, manager); getEnvironment().addDecorator(bean); }
protected <T> void createInterceptor(EnhancedAnnotatedType<T> weldClass) { BeanAttributes<T> attributes = BeanAttributesFactory.forBean(weldClass, getManager()); InterceptorImpl<T> bean = InterceptorImpl.of(attributes, weldClass, manager); getEnvironment().addInterceptor(bean); }
protected <X> void createDisposalMethods(AbstractClassBean<X> declaringBean, EnhancedAnnotatedType<X> annotatedClass) { for (EnhancedAnnotatedMethod<?, ? super X> method : BeanMethods.filterMethods(annotatedClass .getDeclaredEnhancedMethodsWithAnnotatedParameters(Disposes.class))) { DisposalMethod<? super X, ?> disposalBean = DisposalMethod.of(manager, method, declaringBean); getEnvironment().addDisposesMethod(disposalBean); } }
protected void addExtension(ExtensionBean bean) { getEnvironment().addExtension(bean); }
protected void addBuiltInBean(AbstractBuiltInBean<?> bean) { getEnvironment().addBuiltInBean(bean); }