public static <T> SlimAnnotatedTypeContext<T> of(SlimAnnotatedType<T> type, ClassFileInfo classInfo, Set<ExtensionObserverMethodImpl<?, ?>> resolvedProcessAnnotatedTypeObservers) { return new SlimAnnotatedTypeContext<T>(type, classInfo, resolvedProcessAnnotatedTypeObservers, null); }
public void registerAnnotatedTypes() { for (SlimAnnotatedTypeContext<?> ctx : getEnvironment().getAnnotatedTypes()) { annotatedTypeStore.put(ctx.getAnnotatedType()); } }
public ProcessSyntheticAnnotatedTypeImpl(BeanManagerImpl beanManager, SlimAnnotatedTypeContext<T> annotatedTypeContext) { super(beanManager, annotatedTypeContext.getAnnotatedType(), ProcessSyntheticAnnotatedType.class); this.source = annotatedTypeContext.getExtension(); }
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); } } }
public <T> ProcessAnnotatedTypeImpl<T> fireProcessAnnotatedType(BeanManagerImpl beanManager, SlimAnnotatedTypeContext<T> annotatedTypeContext) { if (!isProcessAnnotatedTypeObserved()) { return null; } final Set<ExtensionObserverMethodImpl<?, ?>> observers = annotatedTypeContext.getResolvedProcessAnnotatedTypeObservers(); final SlimAnnotatedType<T> annotatedType = annotatedTypeContext.getAnnotatedType(); // if the fast resolver resolved an empty set of observer methods, skip this event if (observers != null && observers.isEmpty()) { BootstrapLogger.LOG.patSkipped(annotatedType); return null; } ProcessAnnotatedTypeImpl<T> event = null; if (annotatedTypeContext.getExtension() == null) { event = new ProcessAnnotatedTypeImpl<T>(beanManager, annotatedType); } else { event = new ProcessSyntheticAnnotatedTypeImpl<T>(beanManager, annotatedTypeContext); } if (observers == null) { BootstrapLogger.LOG.patDefaultResolver(annotatedType); fireProcessAnnotatedType(event, beanManager); } else { BootstrapLogger.LOG.patFastResolver(annotatedType); fireProcessAnnotatedType(event, annotatedTypeContext.getResolvedProcessAnnotatedTypeObservers()); } return event; }
public void createClassBeans() { SetMultimap<Class<?>, SlimAnnotatedType<?>> otherWeldClasses = SetMultimap.newSetMultimap(); for (SlimAnnotatedTypeContext<?> ctx : getEnvironment().getAnnotatedTypes()) { createClassBean(ctx.getAnnotatedType(), otherWeldClasses); } // create session beans ejbSupport.createSessionBeans(getEnvironment(), otherWeldClasses, getManager()); }
public void createClassBeans() { SetMultimap<Class<?>, SlimAnnotatedType<?>> otherWeldClasses = SetMultimap.newConcurrentSetMultimap(); for (SlimAnnotatedTypeContext<?> ctx : getEnvironment().getAnnotatedTypes()) { createClassBean(ctx.getAnnotatedType(), otherWeldClasses); } // create session beans for (InternalEjbDescriptor<?> ejbDescriptor : getEnvironment().getEjbDescriptors()) { if (getEnvironment().isVetoed(ejbDescriptor.getBeanClass()) || Beans.isVetoed(ejbDescriptor.getBeanClass())) { continue; } if (ejbDescriptor.isSingleton() || ejbDescriptor.isStateful() || ejbDescriptor.isStateless()) { if (otherWeldClasses.get(ejbDescriptor.getBeanClass()) != null) { for (SlimAnnotatedType<?> annotatedType : otherWeldClasses.get(ejbDescriptor.getBeanClass())) { EnhancedAnnotatedType<?> weldClass = classTransformer.getEnhancedAnnotatedType(annotatedType); createSessionBean(ejbDescriptor, Reflections.<EnhancedAnnotatedType> cast(weldClass)); } } else { createSessionBean(ejbDescriptor); } } } }
public void addSyntheticAnnotatedType(SlimAnnotatedType<?> annotatedType, Extension extension) { addAnnotatedType(SlimAnnotatedTypeContext.of(annotatedType, extension)); }
protected <T> SlimAnnotatedTypeContext<T> createContext(SlimAnnotatedType<T> type) { if (type != null) { return SlimAnnotatedTypeContext.of(type); } return null; }
public void trim() { for (Iterator<SlimAnnotatedTypeContext<?>> iterator = annotatedTypes.iterator(); iterator.hasNext(); ) { if (!AnnotatedTypes.hasBeanDefiningAnnotation(iterator.next().getAnnotatedType(), AnnotatedTypes.TRIM_META_ANNOTATIONS)) { iterator.remove(); } } } }
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); } } }
public <T> ProcessAnnotatedTypeImpl<T> fireProcessAnnotatedType(BeanManagerImpl beanManager, SlimAnnotatedTypeContext<T> annotatedTypeContext) { if (!isProcessAnnotatedTypeObserved()) { return null; } final Set<ContainerLifecycleEventObserverMethod<?>> observers = annotatedTypeContext.getResolvedProcessAnnotatedTypeObservers(); final SlimAnnotatedType<T> annotatedType = annotatedTypeContext.getAnnotatedType(); // if the fast resolver resolved an empty set of observer methods, skip this event if (observers != null && observers.isEmpty()) { BootstrapLogger.LOG.patSkipped(annotatedType); return null; } ProcessAnnotatedTypeImpl<T> event = null; if (annotatedTypeContext.getExtension() == null) { event = new ProcessAnnotatedTypeImpl<T>(beanManager, annotatedType); } else { event = new ProcessSyntheticAnnotatedTypeImpl<T>(beanManager, annotatedTypeContext); } if (observers == null) { BootstrapLogger.LOG.patDefaultResolver(annotatedType); fireProcessAnnotatedType(event, beanManager); } else { BootstrapLogger.LOG.patFastResolver(annotatedType); fireProcessAnnotatedType(event, annotatedTypeContext.getResolvedProcessAnnotatedTypeObservers(), beanManager); } return event; }
public void createClassBeans() { SetMultimap<Class<?>, SlimAnnotatedType<?>> otherWeldClasses = SetMultimap.newSetMultimap(); for (SlimAnnotatedTypeContext<?> ctx : getEnvironment().getAnnotatedTypes()) { createClassBean(ctx.getAnnotatedType(), otherWeldClasses); } // create session beans ejbSupport.createSessionBeans(getEnvironment(), otherWeldClasses, getManager()); }
public void addSyntheticAnnotatedType(SlimAnnotatedType<?> annotatedType, Extension extension) { addAnnotatedType(SlimAnnotatedTypeContext.of(annotatedType, extension)); }
protected <T> SlimAnnotatedTypeContext<T> createContext(SlimAnnotatedType<T> type) { if (type != null) { return SlimAnnotatedTypeContext.of(type); } return null; }
public void trim() { for (Iterator<SlimAnnotatedTypeContext<?>> iterator = annotatedTypes.iterator(); iterator.hasNext(); ) { if (!AnnotatedTypes.hasBeanDefiningAnnotation(iterator.next().getAnnotatedType(), AnnotatedTypes.TRIM_META_ANNOTATIONS)) { iterator.remove(); } } } }
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); } } }