use of org.jboss.weld.resources.ClassTransformer in project core by weld.
the class SimpleInterceptorTest method testInterceptorModel.
@Test
public void testInterceptorModel() {
TypeStore typeStore = new TypeStore();
InterceptorBindingModel<SecondaryInterceptionBinding> interceptorBindingModel = new InterceptorBindingModel<SecondaryInterceptionBinding>(new ClassTransformer(typeStore, new SharedObjectCache(), ReflectionCacheFactory.newInstance(typeStore), RegistrySingletonProvider.STATIC_INSTANCE).getEnhancedAnnotation(SecondaryInterceptionBinding.class));
Set<Annotation> annotations = interceptorBindingModel.getInheritedInterceptionBindingTypes();
assert annotations.size() != 0;
}
use of org.jboss.weld.resources.ClassTransformer in project HotswapAgent by HotswapProjects.
the class BeanReloadExecutor method getClassTransformer.
private static ClassTransformer getClassTransformer() {
TypeStore store = new TypeStore();
SharedObjectCache cache = new SharedObjectCache();
ReflectionCache reflectionCache = ReflectionCacheFactory.newInstance(store);
ClassTransformer classTransformer = new ClassTransformer(store, cache, reflectionCache, "STATIC_INSTANCE");
return classTransformer;
}
use of org.jboss.weld.resources.ClassTransformer in project HotswapAgent by HotswapProjects.
the class BeanReloadExecutor method doDefineNewManagedBean.
@SuppressWarnings({ "rawtypes", "unchecked" })
private static void doDefineNewManagedBean(BeanManagerImpl beanManager, String bdaId, Class<?> beanClass) {
try {
ClassTransformer classTransformer = getClassTransformer();
SlimAnnotatedType<?> annotatedType = classTransformer.getBackedAnnotatedType(beanClass, bdaId);
boolean managedBeanOrDecorator = Beans.isTypeManagedBeanOrDecoratorOrInterceptor(annotatedType);
if (managedBeanOrDecorator) {
EnhancedAnnotatedType eat = EnhancedAnnotatedTypeImpl.of(annotatedType, classTransformer);
BeanAttributes attributes = BeanAttributesFactory.forBean(eat, beanManager);
ManagedBean<?> bean = ManagedBean.of(attributes, eat, beanManager);
ReflectionHelper.set(beanManager, beanManager.getClass(), "beanSet", Collections.synchronizedSet(new HashSet<Bean<?>>()));
beanManager.addBean(bean);
beanManager.getBeanResolver().clear();
bean.initializeAfterBeanDiscovery();
LOGGER.debug("Bean defined '{}'", beanClass.getName());
} else {
// TODO : define session bean
LOGGER.warning("Bean NOT? defined '{}', session bean?", beanClass.getName());
}
} catch (Exception e) {
LOGGER.debug("Bean definition failed.", e);
}
}
Aggregations