[webbeans-commits] Webbeans SVN: r400 - in ri/trunk/webbeans-ri/src: test/java/org/jboss/webbeans/test and 1 other directory.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Thu Dec 4 08:22:32 EST 2008


Author: pete.muir at jboss.org
Date: 2008-12-04 08:22:32 -0500 (Thu, 04 Dec 2008)
New Revision: 400

Modified:
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/MetaDataCache.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/AbstractTest.java
Log:
Auto register stereotypes

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/MetaDataCache.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/MetaDataCache.java	2008-12-04 13:19:02 UTC (rev 399)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/MetaDataCache.java	2008-12-04 13:22:32 UTC (rev 400)
@@ -38,23 +38,18 @@
 
    private ConcurrentCache<Class<?>, EjbMetaData<?>> ejbMetaDataMap = new ConcurrentCache<Class<?>, EjbMetaData<?>>();
 
-   public <T extends Annotation> void addStereotype(final Class<T> stereotype)
+   public <T extends Annotation> StereotypeModel<T> getStereotype(final Class<T> stereotype)
    {
-      stereotypes.putIfAbsent(stereotype, new Callable<StereotypeModel<?>>()
+      return stereotypes.putIfAbsent(stereotype, new Callable<StereotypeModel<T>>()
       {
 
-         public StereotypeModel<?> call() throws Exception
+         public StereotypeModel<T> call() throws Exception
          {
             return new StereotypeModel<T>(stereotype);
          }
       });
    }
 
-   public StereotypeModel<?> getStereotype(Class<? extends Annotation> annotationType)
-   {
-      return stereotypes.getValue(annotationType);
-   }
-
    public <T extends Annotation> ScopeModel<T> getScopeModel(final Class<T> scopeType)
    {
       return scopes.putIfAbsent(scopeType, new Callable<ScopeModel<T>>()
@@ -64,7 +59,7 @@
          {
             return new ScopeModel<T>(scopeType);
          }
-   
+
       });
    }
 
@@ -77,7 +72,7 @@
          {
             return new BindingTypeModel<T>(bindingType);
          }
-   
+
       });
    }
 
@@ -90,7 +85,7 @@
          {
             return new EjbMetaData<T>(clazz);
          }
-   
+
       });
    }
 

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/AbstractTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/AbstractTest.java	2008-12-04 13:19:02 UTC (rev 399)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/AbstractTest.java	2008-12-04 13:22:32 UTC (rev 400)
@@ -1,19 +1,11 @@
 package org.jboss.webbeans.test;
 
-import javax.webbeans.Decorator;
-import javax.webbeans.Interceptor;
 import javax.webbeans.Production;
 import javax.webbeans.Standard;
 
 import org.jboss.webbeans.bootstrap.Bootstrap;
-import org.jboss.webbeans.test.annotations.AnimalStereotype;
 import org.jboss.webbeans.test.annotations.AnotherDeploymentType;
-import org.jboss.webbeans.test.annotations.FishStereotype;
 import org.jboss.webbeans.test.annotations.HornedAnimalDeploymentType;
-import org.jboss.webbeans.test.annotations.HornedMammalStereotype;
-import org.jboss.webbeans.test.annotations.MammalStereotype;
-import org.jboss.webbeans.test.annotations.RequestScopedAnimalStereotype;
-import org.jboss.webbeans.test.annotations.RiverFishStereotype;
 import org.jboss.webbeans.test.mock.MockBootstrap;
 import org.jboss.webbeans.test.mock.MockManagerImpl;
 import org.testng.annotations.BeforeMethod;
@@ -35,7 +27,6 @@
    
    protected void init()
    {
-      addStereotypes();
       addEnabledDeploymentTypes();
    }
    
@@ -43,17 +34,5 @@
    {
       manager.setEnabledDeploymentTypes(Standard.class, Production.class, AnotherDeploymentType.class, HornedAnimalDeploymentType.class);
    }
-   
-   protected void addStereotypes()
-   {
-      manager.getMetaDataCache().addStereotype(Decorator.class);
-      manager.getMetaDataCache().addStereotype(Interceptor.class);
-      manager.getMetaDataCache().addStereotype(AnimalStereotype.class);
-      manager.getMetaDataCache().addStereotype(HornedMammalStereotype.class);
-      manager.getMetaDataCache().addStereotype(MammalStereotype.class);
-      manager.getMetaDataCache().addStereotype(FishStereotype.class);
-      manager.getMetaDataCache().addStereotype(RiverFishStereotype.class);
-      manager.getMetaDataCache().addStereotype(RequestScopedAnimalStereotype.class);
-   }
 
 }




More information about the weld-commits mailing list