[weld-commits] Weld SVN: r5431 - in core/trunk/impl/src/main/java/org/jboss/weld: bootstrap/events and 1 other directory.

weld-commits at lists.jboss.org weld-commits at lists.jboss.org
Mon Jan 11 18:06:31 EST 2010


Author: pete.muir at jboss.org
Date: 2010-01-11 18:06:31 -0500 (Mon, 11 Jan 2010)
New Revision: 5431

Modified:
   core/trunk/impl/src/main/java/org/jboss/weld/bean/CustomDecoratorWrapper.java
   core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AfterBeanDiscoveryImpl.java
Log:
WELD-78

Modified: core/trunk/impl/src/main/java/org/jboss/weld/bean/CustomDecoratorWrapper.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bean/CustomDecoratorWrapper.java	2010-01-11 23:02:57 UTC (rev 5430)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bean/CustomDecoratorWrapper.java	2010-01-11 23:06:31 UTC (rev 5431)
@@ -33,36 +33,34 @@
  *
  * @author Marius Bogoevici
  */
-public class CustomDecoratorWrapper extends ForwardingDecorator<Object> implements WeldDecorator<Object>
+public class CustomDecoratorWrapper<T> extends ForwardingDecorator<T> implements WeldDecorator<T>
 {
-   private Decorator<Object> delegate;
-   private WeldClass<?> annotatedItem;
+   private Decorator<T> delegate;
+   private WeldClass<T> weldClass;
 
    private Set<MethodSignature> decoratedMethodSignatures;
 
-   public static CustomDecoratorWrapper of(Decorator<?> delegate, BeanManagerImpl beanManager)
+   public static <T> CustomDecoratorWrapper<T> of(Decorator<T> delegate, BeanManagerImpl beanManager)
    {
-      return new CustomDecoratorWrapper((Decorator<Object>) delegate, beanManager);
+      return new CustomDecoratorWrapper<T>(delegate, beanManager);
    }
 
-   private CustomDecoratorWrapper(Decorator<Object> delegate, BeanManagerImpl beanManager)
+   private CustomDecoratorWrapper(Decorator<T> delegate, BeanManagerImpl beanManager)
    {
       this.delegate = delegate;
-      ClassTransformer transformer = beanManager.getServices().get(ClassTransformer.class);
-      Class<?> beanClass = delegate.getBeanClass();
-      this.annotatedItem =  transformer.loadClass(beanClass);
+      this.weldClass =  beanManager.getServices().get(ClassTransformer.class).loadClass((Class<T>) delegate.getBeanClass());
       this.decoratedMethodSignatures = Deployers.getDecoratedMethodSignatures(beanManager, delegate.getDecoratedTypes());
    }
 
    @Override
-   protected Decorator<Object> delegate()
+   protected Decorator<T> delegate()
    {
       return delegate;
    }
 
    public WeldClass<?> getWeldAnnotated()
    {
-      return annotatedItem;
+      return weldClass;
    }
 
    public Set<MethodSignature> getDecoratedMethodSignatures()

Modified: core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AfterBeanDiscoveryImpl.java
===================================================================
--- core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AfterBeanDiscoveryImpl.java	2010-01-11 23:02:57 UTC (rev 5430)
+++ core/trunk/impl/src/main/java/org/jboss/weld/bootstrap/events/AfterBeanDiscoveryImpl.java	2010-01-11 23:06:31 UTC (rev 5431)
@@ -23,9 +23,9 @@
 import javax.enterprise.context.spi.Context;
 import javax.enterprise.inject.spi.AfterBeanDiscovery;
 import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.Decorator;
+import javax.enterprise.inject.spi.Interceptor;
 import javax.enterprise.inject.spi.ObserverMethod;
-import javax.enterprise.inject.spi.Interceptor;
-import javax.enterprise.inject.spi.Decorator;
 
 import org.jboss.weld.bean.CustomDecoratorWrapper;
 import org.jboss.weld.bootstrap.BeanDeployment;
@@ -63,7 +63,7 @@
       {
          beanManager.addInterceptor((Interceptor<?>) bean);
       }
-      else if (bean instanceof Decorator)
+      else if (bean instanceof Decorator<?>)
       {
          beanManager.addDecorator(CustomDecoratorWrapper.of((Decorator<?>)bean, beanManager));
       }



More information about the weld-commits mailing list