[webbeans-commits] Webbeans SVN: r3488 - in ri/trunk: impl/src/main/java/org/jboss/webbeans/bean and 4 other directories.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Thu Aug 13 20:24:39 EDT 2009


Author: pete.muir at jboss.org
Date: 2009-08-13 20:24:39 -0400 (Thu, 13 Aug 2009)
New Revision: 3488

Added:
   ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/TypeSafeDisposerResolver.java
   ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/DisposalMethodOnOtherBeanNotResolvedTest.java
   ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/Foo.java
   ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/FooDisposer.java
   ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/FooProducer.java
Modified:
   ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployerEnvironment.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverMethodImpl.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/ForwardingResolvable.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/Resolvable.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/ResolvableFactory.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/ResolvableWBClass.java
Log:
WBRI-340

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java	2009-08-13 21:37:28 UTC (rev 3487)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/BeanManagerImpl.java	2009-08-14 00:24:39 UTC (rev 3488)
@@ -544,7 +544,7 @@
       bindingAnnotations.add(new AnyLiteral());
       checkEventType(clazz);
       Set<ObserverMethod<?, T>> observers = new HashSet<ObserverMethod<?, T>>();
-      Set<ObserverMethod<?,?>> eventObservers = observerResolver.resolve(ResolvableFactory.of(new Reflections.HierarchyDiscovery(clazz).getFlattenedTypes(),  bindingAnnotations));
+      Set<ObserverMethod<?,?>> eventObservers = observerResolver.resolve(ResolvableFactory.of(new Reflections.HierarchyDiscovery(clazz).getFlattenedTypes(),  bindingAnnotations, null));
       for (ObserverMethod<?,?> observer : eventObservers)
       {
          observers.add((ObserverMethod<?, T>) observer);
@@ -785,7 +785,7 @@
 =    */
    public void addObserver(ObserverMethod<?, ?> observer)
    {
-      checkEventType(observer.getObservedType());
+      //checkEventType(observer.getObservedType());
       observers.add(observer);
       log.trace("Added observer " + observer);
       for (BeanManagerImpl childActivity : childActivities)
@@ -993,14 +993,14 @@
    {
       checkResolveDecoratorsArguments(types, Arrays.asList(bindings));
       // TODO Fix this cast and make the resolver return a list
-      return new ArrayList<Decorator<?>>(decoratorResolver.resolve(ResolvableFactory.of(types, bindings)));
+      return new ArrayList<Decorator<?>>(decoratorResolver.resolve(ResolvableFactory.of(types, null, bindings)));
    }
    
    public List<Decorator<?>> resolveDecorators(Set<Type> types, Set<Annotation> bindings)
    {
       checkResolveDecoratorsArguments(types, bindings);
       // TODO Fix this cast and make the resolver return a list
-      return new ArrayList<Decorator<?>>(decoratorResolver.resolve(ResolvableFactory.of(types, bindings)));
+      return new ArrayList<Decorator<?>>(decoratorResolver.resolve(ResolvableFactory.of(types, bindings, null)));
    }
 
    private void checkResolveDecoratorsArguments(Set<Type> types, Collection<Annotation> bindings)

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java	2009-08-13 21:37:28 UTC (rev 3487)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java	2009-08-14 00:24:39 UTC (rev 3488)
@@ -163,7 +163,7 @@
     */
    protected void initDisposalMethod(BeanDeployerEnvironment environment)
    {
-      Set<DisposalMethodBean<T>> disposalBeans = environment.resolveDisposalBeans(getAnnotatedItem());
+      Set<DisposalMethodBean<?>> disposalBeans = environment.resolveDisposalBeans(getTypes(), getBindings(), getDeclaringBean());
 
       if (disposalBeans.size() == 1)
       {

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployerEnvironment.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployerEnvironment.java	2009-08-13 21:37:28 UTC (rev 3487)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bootstrap/BeanDeployerEnvironment.java	2009-08-14 00:24:39 UTC (rev 3488)
@@ -16,6 +16,8 @@
  */
 package org.jboss.webbeans.bootstrap;
 
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
@@ -37,39 +39,35 @@
 import org.jboss.webbeans.bean.standard.AbstractStandardBean;
 import org.jboss.webbeans.bean.standard.ExtensionBean;
 import org.jboss.webbeans.ejb.EjbDescriptorCache;
-import org.jboss.webbeans.introspector.WBAnnotated;
 import org.jboss.webbeans.introspector.WBClass;
 import org.jboss.webbeans.introspector.WBMethod;
 import org.jboss.webbeans.resolution.ResolvableFactory;
-import org.jboss.webbeans.resolution.TypeSafeBeanResolver;
-import org.jboss.webbeans.resolution.TypeSafeResolver;
+import org.jboss.webbeans.resolution.TypeSafeDisposerResolver;
 
 public class BeanDeployerEnvironment
 {
 
    private final Map<WBClass<?>, AbstractClassBean<?>> classBeanMap;
    private final Map<WBMethod<?, ?>, ProducerMethodBean<?>> producerMethodBeanMap;
-   private final Map<WBMethod<?, ?>, DisposalMethodBean<?>> disposalMethodBeanMap;
    private final Set<RIBean<?>> beans;
    private final Set<ObserverMethod<?, ?>> observers;
    private final List<DisposalMethodBean<?>> allDisposalBeans;
    private final Set<DisposalMethodBean<?>> resolvedDisposalBeans;
    private final Set<DecoratorBean<?>> decorators;
    private final EjbDescriptorCache ejbDescriptors;
-   private final TypeSafeResolver<DisposalMethodBean<?>> disposalMethodResolver;
+   private final TypeSafeDisposerResolver disposalMethodResolver;
 
    public BeanDeployerEnvironment(EjbDescriptorCache ejbDescriptors, BeanManagerImpl manager)
    {
       this.classBeanMap = new HashMap<WBClass<?>, AbstractClassBean<?>>();
       this.producerMethodBeanMap = new HashMap<WBMethod<?, ?>, ProducerMethodBean<?>>();
-      this.disposalMethodBeanMap = new HashMap<WBMethod<?, ?>, DisposalMethodBean<?>>();
       this.allDisposalBeans = new ArrayList<DisposalMethodBean<?>>();
       this.resolvedDisposalBeans = new HashSet<DisposalMethodBean<?>>();
       this.beans = new HashSet<RIBean<?>>();
       this.decorators = new HashSet<DecoratorBean<?>>();
       this.observers = new HashSet<ObserverMethod<?, ?>>();
       this.ejbDescriptors = ejbDescriptors;
-      this.disposalMethodResolver = new TypeSafeBeanResolver<DisposalMethodBean<?>>(manager, allDisposalBeans);
+      this.disposalMethodResolver = new TypeSafeDisposerResolver(manager, allDisposalBeans);
    }
 
    public ProducerMethodBean<?> getProducerMethod(WBMethod<?, ?> method)
@@ -85,22 +83,7 @@
          return bean;
       }
    }
-
    
-   public DisposalMethodBean<?> getDisposalMethod(WBMethod<?, ?> method)
-   {
-      if (!producerMethodBeanMap.containsKey(method))
-      {
-         return null;
-      }
-      else
-      {
-         DisposalMethodBean<?> bean = disposalMethodBeanMap.get(method);
-         bean.initialize(this);
-         return bean;
-      }
-   }
-   
    public AbstractClassBean<?> getClassBean(WBClass<?> clazz)
    {
       if (!classBeanMap.containsKey(clazz))
@@ -153,7 +136,6 @@
    public void addBean(DisposalMethodBean<?> bean)
    {
       allDisposalBeans.add(bean);
-      disposalMethodBeanMap.put(bean.getAnnotatedItem(), bean);
    }
    
    public void addObserver(ObserverMethod<?, ?> observer)
@@ -198,17 +180,11 @@
     * @param bindings The binding types to match
     * @return The set of matching disposal methods
     */
-   public <T> Set<DisposalMethodBean<T>> resolveDisposalBeans(WBAnnotated<T, ?> annotatedItem)
+   public Set<DisposalMethodBean<?>> resolveDisposalBeans(Set<Type> types, Set<Annotation> bindings, AbstractClassBean<?> declaringBean)
    {
-      // Correct?
-      Set<DisposalMethodBean<?>> beans = disposalMethodResolver.resolve(ResolvableFactory.of(annotatedItem));
-      Set<DisposalMethodBean<T>> disposalBeans = new HashSet<DisposalMethodBean<T>>();
-      for (DisposalMethodBean<?> bean : beans)
-      {
-         disposalBeans.add((DisposalMethodBean<T>) bean);
-      }
-      resolvedDisposalBeans.addAll(disposalBeans);
-      return Collections.unmodifiableSet(disposalBeans);
+      Set<DisposalMethodBean<?>> beans = disposalMethodResolver.resolve(ResolvableFactory.of(types, bindings, declaringBean));
+      resolvedDisposalBeans.addAll(beans);
+      return Collections.unmodifiableSet(beans);
    }
 
 }

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverMethodImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverMethodImpl.java	2009-08-13 21:37:28 UTC (rev 3487)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverMethodImpl.java	2009-08-14 00:24:39 UTC (rev 3488)
@@ -19,7 +19,6 @@
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Type;
 import java.lang.reflect.TypeVariable;
-import java.lang.reflect.WildcardType;
 import java.util.Arrays;
 import java.util.HashSet;
 import java.util.List;
@@ -112,10 +111,10 @@
                {
                   throw new DefinitionException("Cannot use a type variable " + type + " in an parameterized type " + toString());
                }
-               else if (type instanceof WildcardType)
-               {
-                  throw new DefinitionException("Cannot use a wildcard variable " + type + " in an parameterized type " + toString());
-               }
+//               else if (type instanceof WildcardType)
+//               {
+//                  throw new DefinitionException("Cannot use a wildcard variable " + type + " in an parameterized type " + toString());
+//               }
             }
          }
       }

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/ForwardingResolvable.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/ForwardingResolvable.java	2009-08-13 21:37:28 UTC (rev 3487)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/ForwardingResolvable.java	2009-08-14 00:24:39 UTC (rev 3488)
@@ -20,6 +20,8 @@
 import java.lang.reflect.Type;
 import java.util.Set;
 
+import org.jboss.webbeans.bean.AbstractClassBean;
+
 public abstract class ForwardingResolvable implements Resolvable
 {
    
@@ -54,6 +56,11 @@
    {
       return delegate().getJavaClass();
    }
+   
+   public AbstractClassBean<?> getDeclaringBean()
+   {
+      return delegate().getDeclaringBean();
+   }
 
    @Override
    public boolean equals(Object obj)

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/Resolvable.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/Resolvable.java	2009-08-13 21:37:28 UTC (rev 3487)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/Resolvable.java	2009-08-14 00:24:39 UTC (rev 3488)
@@ -20,6 +20,8 @@
 import java.lang.reflect.Type;
 import java.util.Set;
 
+import org.jboss.webbeans.bean.AbstractClassBean;
+
 /**
  * Something that is resovable by the resolver. A resolvable is defined by it's
  * bindings and type closure
@@ -78,5 +80,11 @@
     * @return the java class
     */
    public Class<?> getJavaClass();
+   
+   /**
+    * Get the declaring the injection point, or null if there is none
+    * @return
+    */
+   public AbstractClassBean<?> getDeclaringBean();
 
 }

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/ResolvableFactory.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/ResolvableFactory.java	2009-08-13 21:37:28 UTC (rev 3487)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/ResolvableFactory.java	2009-08-14 00:24:39 UTC (rev 3488)
@@ -24,6 +24,7 @@
 import java.util.Map;
 import java.util.Set;
 
+import org.jboss.webbeans.bean.AbstractClassBean;
 import org.jboss.webbeans.introspector.WBAnnotated;
 import org.jboss.webbeans.literal.CurrentLiteral;
 import org.jboss.webbeans.util.Reflections;
@@ -41,18 +42,18 @@
       {
          Set<Type> types = new HashSet<Type>();
          types.add(element.getBaseType());
-         return new ResolvableImpl(element.getBindings(), types);
+         return new ResolvableImpl(element.getBindings(), types, null);
       }
    }
 
-   public static Resolvable of(Set<Type> typeClosure, Set<Annotation> bindings)
+   public static Resolvable of(Set<Type> typeClosure, Set<Annotation> bindings, AbstractClassBean<?> declaringBean)
    {
-      return new ResolvableImpl(bindings, typeClosure);
+      return new ResolvableImpl(bindings, typeClosure, declaringBean);
    }
 
-   public static Resolvable of(Set<Type> typeClosure, Annotation... bindings)
+   public static Resolvable of(Set<Type> typeClosure, AbstractClassBean<?> declaringBean, Annotation... bindings)
    {
-      return new ResolvableImpl(new HashSet<Annotation>(Arrays.asList(bindings)), typeClosure);
+      return new ResolvableImpl(new HashSet<Annotation>(Arrays.asList(bindings)), typeClosure, declaringBean);
    }
 
    private ResolvableFactory() {}
@@ -63,8 +64,9 @@
       private final Set<Annotation> bindings;
       private final Map<Class<? extends Annotation>, Annotation> annotations;
       private final Set<Type> typeClosure;
+      private final AbstractClassBean<?> declaringBean;
 
-      public ResolvableImpl(Set<Annotation> bindings, Set<Type> typeClosure)
+      public ResolvableImpl(Set<Annotation> bindings, Set<Type> typeClosure, AbstractClassBean<?> declaringBean)
       {
          this.bindings = bindings;
          if (bindings.size() == 0)
@@ -77,6 +79,7 @@
          {
             annotations.put(annotation.annotationType(), annotation);
          }
+         this.declaringBean = declaringBean;
       }
 
       public Set<Annotation> getBindings()
@@ -109,6 +112,11 @@
          // No underlying java class
          return null;
       }
+      
+      public AbstractClassBean<?> getDeclaringBean()
+      {
+         return declaringBean;
+      }
 
       @Override
       public String toString()

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/ResolvableWBClass.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/ResolvableWBClass.java	2009-08-13 21:37:28 UTC (rev 3487)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/ResolvableWBClass.java	2009-08-14 00:24:39 UTC (rev 3488)
@@ -31,6 +31,7 @@
 import javax.enterprise.inject.spi.InjectionPoint;
 
 import org.jboss.webbeans.BeanManagerImpl;
+import org.jboss.webbeans.bean.AbstractClassBean;
 import org.jboss.webbeans.injection.WBInjectionPoint;
 import org.jboss.webbeans.introspector.AnnotationStore;
 import org.jboss.webbeans.introspector.WBAnnotated;
@@ -196,6 +197,11 @@
    {
       return typeClosure;
    }
+   
+   public AbstractClassBean<?> getDeclaringBean()
+   {
+      return null;
+   }
 
    @Override
    public Type getBaseType()

Added: ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/TypeSafeDisposerResolver.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/TypeSafeDisposerResolver.java	                        (rev 0)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/TypeSafeDisposerResolver.java	2009-08-14 00:24:39 UTC (rev 3488)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.resolution;
+
+import java.util.Collections;
+import java.util.Set;
+
+import org.jboss.webbeans.BeanManagerImpl;
+import org.jboss.webbeans.bean.DisposalMethodBean;
+import org.jboss.webbeans.util.Beans;
+import org.jboss.webbeans.util.Reflections;
+
+/**
+ * @author pmuir
+ *
+ */
+public class TypeSafeDisposerResolver extends TypeSafeResolver<DisposalMethodBean<?>>
+{
+
+   private final BeanManagerImpl manager;
+
+   public TypeSafeDisposerResolver(BeanManagerImpl manager, Iterable<DisposalMethodBean<?>> disposers)
+   {
+      super(disposers);
+      this.manager = manager;
+   }
+
+   @Override
+   protected boolean matches(Resolvable resolvable, DisposalMethodBean<?> disposer)
+   {
+         return resolvable.getDeclaringBean().equals(disposer.getDeclaringBean()) && Reflections.isAssignableFrom(disposer.getType(), resolvable.getTypeClosure()) && Beans.containsAllBindings(disposer.getBindings(), resolvable.getBindings(), manager);
+   }
+   
+   /**
+    * @return the manager
+    */
+   public BeanManagerImpl getManager()
+   {
+      return manager;
+   }
+
+   @Override
+   protected Set<DisposalMethodBean<?>> filterResult(Set<DisposalMethodBean<?>> matched)
+   {
+      return matched;
+   }
+
+   @Override
+   protected Iterable<ResolvableTransformer> getTransformers()
+   {
+      return Collections.emptySet();
+   }
+
+   @Override
+   protected Set<DisposalMethodBean<?>> sortResult(Set<DisposalMethodBean<?>> matched)
+   {
+      return matched;
+   }
+
+}


Property changes on: ri/trunk/impl/src/main/java/org/jboss/webbeans/resolution/TypeSafeDisposerResolver.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/DisposalMethodOnOtherBeanNotResolvedTest.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/DisposalMethodOnOtherBeanNotResolvedTest.java	                        (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/DisposalMethodOnOtherBeanNotResolvedTest.java	2009-08-14 00:24:39 UTC (rev 3488)
@@ -0,0 +1,27 @@
+package org.jboss.webbeans.test.unit.implementation.producer.method;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.webbeans.test.AbstractWebBeansTest;
+import org.testng.annotations.Test;
+
+ at Artifact
+public class DisposalMethodOnOtherBeanNotResolvedTest extends AbstractWebBeansTest
+{
+   @Test
+   public void test()
+   {
+      FooDisposer.reset();
+      FooProducer.reset();
+      Bean<Foo> bean = getBean(Foo.class);
+      CreationalContext<Foo> ctx = getCurrentManager().createCreationalContext(bean);
+      Foo instance = bean.create(ctx);
+      assert instance.getBlah().equals("foo!");
+      bean.destroy(instance, ctx);
+      assert !FooDisposer.isDisposed();
+      assert FooProducer.isDisposed();
+   }
+
+}


Property changes on: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/DisposalMethodOnOtherBeanNotResolvedTest.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/Foo.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/Foo.java	                        (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/Foo.java	2009-08-14 00:24:39 UTC (rev 3488)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.test.unit.implementation.producer.method;
+
+/**
+ * @author pmuir
+ *
+ */
+public class Foo
+{
+   
+   private final String blah;
+   
+   public Foo(String blah)
+   {
+      this.blah = blah;
+   }
+
+   /**
+    * @return the blah
+    */
+   public String getBlah()
+   {
+      return blah;
+   }
+
+}


Property changes on: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/Foo.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/FooDisposer.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/FooDisposer.java	                        (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/FooDisposer.java	2009-08-14 00:24:39 UTC (rev 3488)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.test.unit.implementation.producer.method;
+
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Produces;
+
+/**
+ * @author pmuir
+ *
+ */
+public class FooDisposer
+{
+
+   private static boolean disposed;
+   
+   public static void reset()
+   {
+      disposed = false;
+   }
+   
+   void disposeFoo(@Disposes @Any Foo foo)
+   {
+      disposed = true;
+   }
+   
+   /**
+    * @return the disposed
+    */
+   public static boolean isDisposed()
+   {
+      return disposed;
+   }
+   
+   @Produces @Important
+   public Foo getFoo()
+   {
+      return new Foo("bar!");
+   }
+   
+}


Property changes on: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/FooDisposer.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Added: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/FooProducer.java
===================================================================
--- ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/FooProducer.java	                        (rev 0)
+++ ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/FooProducer.java	2009-08-14 00:24:39 UTC (rev 3488)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,  
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.webbeans.test.unit.implementation.producer.method;
+
+import javax.enterprise.inject.Current;
+import javax.enterprise.inject.Disposes;
+import javax.enterprise.inject.Produces;
+
+/**
+ * @author pmuir
+ *
+ */
+public class FooProducer
+{
+
+   @Produces Foo getFoo()
+   {
+      return new Foo("foo!");
+   }
+   
+   private static boolean disposed;
+   
+   public static void reset()
+   {
+      disposed = false;
+   }
+   
+   public void disposeFoo(@Disposes @Current Foo foo)
+   {
+      disposed = true;
+   }
+   
+   /**
+    * @return the disposed
+    */
+   public static boolean isDisposed()
+   {
+      return disposed;
+   }
+   
+}


Property changes on: ri/trunk/tests/src/test/java/org/jboss/webbeans/test/unit/implementation/producer/method/FooProducer.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain




More information about the weld-commits mailing list