[webbeans-commits] Webbeans SVN: r2307 - ri/trunk/impl/src/main/java/org/jboss/webbeans/bean.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Sun Apr 5 18:49:02 EDT 2009


Author: danielc.roth
Date: 2009-04-05 18:49:01 -0400 (Sun, 05 Apr 2009)
New Revision: 2307

Modified:
   ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DisposalMethodBean.java
Log:
Disposal Methods oops...

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DisposalMethodBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DisposalMethodBean.java	2009-04-05 22:01:20 UTC (rev 2306)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/DisposalMethodBean.java	2009-04-05 22:49:01 UTC (rev 2307)
@@ -14,7 +14,6 @@
 import javax.inject.Disposes;
 import javax.inject.Initializer;
 import javax.inject.Produces;
-import javax.inject.manager.Bean;
 import javax.inject.manager.InjectionPoint;
 
 import org.jboss.webbeans.ManagerImpl;
@@ -22,7 +21,6 @@
 import org.jboss.webbeans.injection.AnnotatedInjectionPoint;
 import org.jboss.webbeans.injection.MethodInjectionPoint;
 import org.jboss.webbeans.injection.ParameterInjectionPoint;
-import org.jboss.webbeans.introspector.AnnotatedItem;
 import org.jboss.webbeans.introspector.AnnotatedMethod;
 import org.jboss.webbeans.introspector.AnnotatedParameter;
 
@@ -38,8 +36,8 @@
       initInjectionPoints();
       initType();
       initTypes();
-      this.id = createId("DisposalMethod-" + declaringBean.getName() + "-"+ disposalMethod.getSignature().toString());
-      
+      this.id = createId("DisposalMethod-" + declaringBean.getName() + "-" + disposalMethod.getSignature().toString());
+
    }
 
    protected AbstractClassBean<?> declaringBean;
@@ -53,10 +51,11 @@
       this.type = (Class<T>) disposalMethodInjectionPoint.getAnnotatedParameters(Disposes.class).get(0).getRawType();
    }
 
-   public AnnotatedMethod<T> getAnnotatedItem() {
-	   return disposalMethodInjectionPoint;
+   public AnnotatedMethod<T> getAnnotatedItem()
+   {
+      return disposalMethodInjectionPoint;
    }
-   
+
    public static <T> DisposalMethodBean<T> of(ManagerImpl manager, AnnotatedMethod<T> disposalMethod, AbstractClassBean<?> declaringBean)
    {
       return new DisposalMethodBean<T>(manager, disposalMethod, declaringBean);
@@ -95,6 +94,20 @@
       return declaringBean.getDeploymentType();
    }
 
+   /**
+    * Initializes the API types
+    */
+   @Override
+   protected void initTypes()
+   {
+      Set<Type> types = new HashSet<Type>();
+      types = new HashSet<Type>();
+      types.addAll(disposalMethodInjectionPoint.getAnnotatedParameters(Disposes.class).get(0).getFlattenedTypeHierarchy());
+      types.add(getType());
+      types.add(Object.class);
+      super.types = types;
+   }
+
    public Set<AnnotatedInjectionPoint<?, ?>> getInjectionPoints()
    {
       return injectionPoints;
@@ -143,7 +156,7 @@
 
    public void invokeDisposeMethod(Object instance)
    {
-	   
+
       List<Object> parameters = new LinkedList<Object>();
 
       parameters.add(instance);
@@ -158,11 +171,11 @@
 
       try
       {
-    	  disposalMethodInjectionPoint.invoke(beanInstance, parameters.toArray());
+         disposalMethodInjectionPoint.invoke(beanInstance, parameters.toArray());
       }
       catch (Exception e)
       {
-         // TODO: 
+         // TODO:
       }
 
    }
@@ -234,8 +247,8 @@
          throw new IllegalStateException(toString() + " does not specialize a bean");
       }
       this.specializedBean = environment.getProducerMethod(superClassMethod);
-   }   
-   
+   }
+
    @Override
    public Class<T> getType()
    {




More information about the weld-commits mailing list