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

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Mon Aug 11 12:32:44 EDT 2008


Author: pete.muir at jboss.org
Date: 2008-08-11 12:32:44 -0400 (Mon, 11 Aug 2008)
New Revision: 95

Added:
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedItem.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedMethod.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedType.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedItem.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedMethod.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedType.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractClassComponentModel.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractComponentModel.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/ProducerMethodComponentModel.java
Removed:
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractComponentModel.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/AbstractAnnotatedItem.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/AnnotatedItem.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/ClassAnnotatedItem.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/MutableAnnotatedItem.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/MutableAnnotatedItemTest.java
Modified:
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ComponentInstanceImpl.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/deployment/DeploymentStrategy.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/EnterpriseComponentModel.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/JmsComponentModel.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/MergedStereotypesModel.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/RemoteComponentModel.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/SimpleComponentModel.java
   ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/StereotypeModel.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ClassAnnotatedItemTest.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ConstructorMetaModelTest.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EnterpriseComponentModelTest.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleComponentModelTest.java
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypeMetaModelTest.java
Log:
Restructure component model to support JMS and producers

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ComponentInstanceImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ComponentInstanceImpl.java	2008-08-10 15:36:43 UTC (rev 94)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ComponentInstanceImpl.java	2008-08-11 16:32:44 UTC (rev 95)
@@ -7,6 +7,7 @@
 import javax.webbeans.ComponentInstance;
 import javax.webbeans.Container;
 
+import org.jboss.webbeans.model.AbstractClassComponentModel;
 import org.jboss.webbeans.model.AbstractComponentModel;
 import org.jboss.webbeans.util.LoggerUtil;
 

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/deployment/DeploymentStrategy.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/deployment/DeploymentStrategy.java	2008-08-10 15:36:43 UTC (rev 94)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/deployment/DeploymentStrategy.java	2008-08-11 16:32:44 UTC (rev 95)
@@ -14,13 +14,13 @@
 
 import org.jboss.webbeans.ComponentInstanceImpl;
 import org.jboss.webbeans.ContainerImpl;
+import org.jboss.webbeans.introspector.SimpleAnnotatedType;
+import org.jboss.webbeans.introspector.SimpleAnnotatedType;
 import org.jboss.webbeans.model.SimpleComponentModel;
 import org.jboss.webbeans.model.StereotypeModel;
 import org.jboss.webbeans.scannotation.AnnotationDB;
 import org.jboss.webbeans.scannotation.ClasspathUrlFinder;
-import org.jboss.webbeans.util.ClassAnnotatedItem;
 import org.jboss.webbeans.util.LoggerUtil;
-import org.jboss.webbeans.util.MutableAnnotatedItem;
 import org.jboss.webbeans.util.Reflections;
 
 /**
@@ -105,7 +105,7 @@
                Class<?> stereotypeClass = Reflections.classForName(className);
                if (stereotypeClass.isAnnotation())
                {
-                  StereotypeModel stereotypeModel = new StereotypeModel(new ClassAnnotatedItem(stereotypeClass));
+                  StereotypeModel stereotypeModel = new StereotypeModel(new SimpleAnnotatedType(stereotypeClass));
                   container.getStereotypeManager().addStereotype(stereotypeModel);
                   log.info("Stereotype: " + stereotypeModel);
                }
@@ -139,8 +139,8 @@
                      if (!componentClass.isAnnotation())
                      {
                         SimpleComponentModel componentModel = new SimpleComponentModel(
-                              new ClassAnnotatedItem(componentClass), 
-                              new MutableAnnotatedItem(null, new HashMap()), container);  
+                              new SimpleAnnotatedType(componentClass), 
+                              new SimpleAnnotatedType(null, new HashMap()), container);  
                         container.addComponent(new ComponentInstanceImpl(componentModel));
                         log.info("Web Bean: " + componentModel);
                      }

Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedItem.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedItem.java	                        (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedItem.java	2008-08-11 16:32:44 UTC (rev 95)
@@ -0,0 +1,48 @@
+package org.jboss.webbeans.introspector;
+
+import java.lang.annotation.Annotation;
+import java.util.Set;
+
+
+/**
+ * AnnotatedItem provides a uniform access to the annotations on an annotated
+ * item defined either in Java or XML 
+ * 
+ * @author Pete Muir
+ *
+ */
+public interface AnnotatedItem
+{
+
+   /**
+    * Get all annotations on the item
+    * 
+    * An empty set is returned if no annotations are present
+    */
+   public abstract <T extends Annotation> Set<T> getAnnotations();
+
+   /**
+    * Get all annotations which are annotated with the given meta annotation 
+    * type
+    * 
+    * If no annotations are present which are annotated with the given meta
+    * annotation an empty set is returned
+    */
+   public abstract <T extends Annotation> Set<Annotation> getAnnotations(
+         Class<T> metaAnnotationType);
+
+   /**
+    * Get an annotation for the annotation type specified.
+    * 
+    * If the annotation isn't present, null is returned
+    */
+   public abstract <T extends Annotation> T getAnnotation(
+         Class<T> annotationType);
+
+   /**
+    * Return true if the annotation type specified is present
+    */
+   public abstract boolean isAnnotationPresent(
+         Class<? extends Annotation> annotationType);
+
+}
\ No newline at end of file


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

Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedMethod.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedMethod.java	                        (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedMethod.java	2008-08-11 16:32:44 UTC (rev 95)
@@ -0,0 +1,17 @@
+package org.jboss.webbeans.introspector;
+
+import java.lang.reflect.Method;
+
+/**
+ * AnnotatedType provides a uniform access to the annotations on an annotated
+ * class defined either in Java or XML 
+ * 
+ * @author Pete Muir
+ *
+ */
+public interface AnnotatedMethod extends AnnotatedItem
+{
+   
+   public Method getAnnotatedMethod();
+
+}


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

Copied: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedType.java (from rev 78, ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/AnnotatedItem.java)
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedType.java	                        (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedType.java	2008-08-11 16:32:44 UTC (rev 95)
@@ -0,0 +1,20 @@
+package org.jboss.webbeans.introspector;
+
+
+/**
+ * AnnotatedType provides a uniform access to the annotations on an annotated
+ * class defined either in Java or XML 
+ * 
+ * @author Pete Muir
+ *
+ */
+public interface AnnotatedType extends AnnotatedItem
+{
+   
+   /**
+    * Return the class of the annotated item. If this annotatedItem isn't in use
+    * then this method should return null
+    */
+   public Class<?> getAnnotatedClass();
+   
+}
\ No newline at end of file


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

Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedItem.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedItem.java	                        (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedItem.java	2008-08-11 16:32:44 UTC (rev 95)
@@ -0,0 +1,99 @@
+package org.jboss.webbeans.introspector;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.AnnotatedElement;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.Map.Entry;
+
+public class SimpleAnnotatedItem implements AnnotatedItem
+{
+
+   private Map<Class<? extends Annotation>, Annotation> annotationMap;
+   private Map<Class<? extends Annotation>, Set<Annotation>> metaAnnotations;
+   private Set<Annotation> annotationSet;
+   
+   public SimpleAnnotatedItem(Map<Class<? extends Annotation>, Annotation> annotationMap)
+   {
+      if (annotationMap == null)
+      {
+         throw new NullPointerException("annotationMap cannot be null");
+      }
+      this.annotationMap = annotationMap;
+   }
+   
+   protected static Map<Class<? extends Annotation>, Annotation> buildAnnotationMap(AnnotatedElement element)
+   {
+      Map<Class<? extends Annotation>, Annotation> annotationMap = new HashMap<Class<? extends Annotation>, Annotation>();
+      for (Annotation annotation : element.getAnnotations())
+      {
+         annotationMap.put(annotation.annotationType(), annotation);
+      }
+      return annotationMap;
+   }
+
+   protected static Set<Annotation> populateAnnotationSet(Set<Annotation> annotationSet, Map<Class<? extends Annotation>, Annotation> annotationMap)
+   {
+      for (Entry<Class<? extends Annotation>, Annotation> entry : annotationMap.entrySet())
+      {
+         annotationSet.add(entry.getValue());
+      }
+      return annotationSet;
+   }
+
+   @SuppressWarnings("unchecked")
+   public <T extends Annotation> T getAnnotation(Class<T> annotationType)
+   {
+      return (T) annotationMap.get(annotationType);
+   }
+
+   public <T extends Annotation> Set<Annotation> getAnnotations(Class<T> metaAnnotationType)
+   {
+      if (metaAnnotations == null)
+      {
+         metaAnnotations = new HashMap<Class<? extends Annotation>, Set<Annotation>>();
+      }
+      populateMetaAnnotationMap(metaAnnotationType, metaAnnotations, annotationMap);
+      return metaAnnotations.get(metaAnnotationType);
+   }
+
+   public Set<Annotation> getAnnotations()
+   {
+      if (annotationSet == null)
+      {
+         annotationSet = populateAnnotationSet(new HashSet<Annotation>(), annotationMap);
+      }
+      return annotationSet;
+   }
+
+   public boolean isAnnotationPresent(Class<? extends Annotation> annotatedType)
+   {
+      return annotationMap.containsKey(annotatedType);
+   }
+
+   protected static <T extends Annotation> Map<Class<? extends Annotation>, Set<Annotation>> populateMetaAnnotationMap(
+         Class<T> metaAnnotationType, Map<Class<? extends Annotation>, Set<Annotation>> metaAnnotations, Map<Class<? extends Annotation>, Annotation> annotationMap)
+   {
+      if (!metaAnnotations.containsKey(metaAnnotationType))
+      {
+         Set<Annotation> s = new HashSet<Annotation>();
+         for (Entry<Class<? extends Annotation>, Annotation> entry : annotationMap.entrySet())
+         {
+            if (entry.getValue().annotationType().isAnnotationPresent(metaAnnotationType))
+            {
+               s.add(entry.getValue());
+            }
+         }
+         metaAnnotations.put(metaAnnotationType, s);
+      }
+      return metaAnnotations;
+   }
+
+   protected Map<Class<? extends Annotation>, Annotation> getAnnotationMap()
+   {
+      return annotationMap;
+   }
+
+}
\ No newline at end of file


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

Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedMethod.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedMethod.java	                        (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedMethod.java	2008-08-11 16:32:44 UTC (rev 95)
@@ -0,0 +1,27 @@
+package org.jboss.webbeans.introspector;
+
+import java.lang.reflect.Method;
+
+public class SimpleAnnotatedMethod extends SimpleAnnotatedItem implements AnnotatedMethod
+{
+   
+   private Method annotatedMethod;
+   
+   public SimpleAnnotatedMethod(Method method)
+   {
+      super(buildAnnotationMap(method));
+      this.annotatedMethod = method;
+   }
+
+   public Method getAnnotatedMethod()
+   {
+      return annotatedMethod;
+   }
+   
+   @Override
+   public String toString()
+   {
+      return annotatedMethod + " " + getAnnotatedMethod().toString();
+   }
+
+}


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

Copied: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedType.java (from rev 78, ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/AbstractAnnotatedItem.java)
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedType.java	                        (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedType.java	2008-08-11 16:32:44 UTC (rev 95)
@@ -0,0 +1,40 @@
+package org.jboss.webbeans.introspector;
+
+import java.lang.annotation.Annotation;
+import java.util.Map;
+
+/**
+ * Base class for implementing AnnotatedItem. This implementation assumes 
+ * the annotationMap is immutable.
+ * 
+ * @author pmuir
+ *
+ */
+public class SimpleAnnotatedType extends SimpleAnnotatedItem implements AnnotatedType
+{
+   
+   private Class<?> annotatedClass;
+   
+   public SimpleAnnotatedType(Class<?> annotatedClass, Map<Class<? extends Annotation>, Annotation> annotationMap)
+   {
+      super(annotationMap);
+      this.annotatedClass = annotatedClass;
+   }
+   
+   public SimpleAnnotatedType(Class<?> annotatedClass)
+   {
+      this(annotatedClass, buildAnnotationMap(annotatedClass));
+   }
+   
+   public Class<?> getAnnotatedClass()
+   {
+      return annotatedClass;
+   }
+   
+   @Override
+   public String toString()
+   {
+      return annotatedClass + " " + super.getAnnotationMap().toString();
+   }
+
+}
\ No newline at end of file


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

Copied: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractClassComponentModel.java (from rev 93, ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractComponentModel.java)
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractClassComponentModel.java	                        (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractClassComponentModel.java	2008-08-11 16:32:44 UTC (rev 95)
@@ -0,0 +1,385 @@
+package org.jboss.webbeans.model;
+
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.logging.Logger;
+
+import javax.webbeans.Dependent;
+import javax.webbeans.DeploymentType;
+import javax.webbeans.Destroys;
+import javax.webbeans.Named;
+import javax.webbeans.ScopeType;
+
+import org.jboss.webbeans.ContainerImpl;
+import org.jboss.webbeans.bindings.DependentBinding;
+import org.jboss.webbeans.bindings.ProductionBinding;
+import org.jboss.webbeans.ejb.EjbMetaData;
+import org.jboss.webbeans.injectable.InjectableMethod;
+import org.jboss.webbeans.introspector.AnnotatedItem;
+import org.jboss.webbeans.introspector.AnnotatedType;
+import org.jboss.webbeans.util.LoggerUtil;
+import org.jboss.webbeans.util.Reflections;
+import org.jboss.webbeans.util.Strings;
+
+
+
+/**
+ * Web Beans Component meta model
+ * 
+ * @author Pete Muir
+ * 
+ */
+public abstract class AbstractClassComponentModel<T> extends AbstractComponentModel<T>
+{
+
+   private static Logger log = LoggerUtil.getLogger(LOGGER_NAME);
+   
+   private Annotation deploymentType;
+   private MergedStereotypesModel mergedStereotypes;
+   private String name;
+   private Annotation scopeType;
+   private Class<? extends T> type;
+   private Set<Annotation> bindingTypes;
+   
+   /**
+    * 
+    * @param annotatedItem Annotations read from java classes
+    * @param xmlAnnotatedItem Annotations read from XML
+    * @param container
+    */
+   @SuppressWarnings("unchecked")
+   public AbstractClassComponentModel(AnnotatedType annotatedItem, AnnotatedType xmlAnnotatedItem, ContainerImpl container)
+   {
+      if (annotatedItem == null)
+      {
+         throw new NullPointerException("annotatedItem must not be null. If the component is declared just in XML, pass in an empty annotatedItem");
+      }
+      
+      if (xmlAnnotatedItem == null)
+      {
+         throw new NullPointerException("xmlAnnotatedItem must not be null. If the component is declared just in Java, pass in an empty xmlAnnotatedItem");
+      }
+      this.type = (Class<? extends T>) initType(annotatedItem, xmlAnnotatedItem);
+      log.fine("Building Web Bean component metadata for " +  type);
+      this.bindingTypes = initBindingTypes(annotatedItem, xmlAnnotatedItem);
+      mergedStereotypes = new MergedStereotypesModel(annotatedItem, xmlAnnotatedItem, container);
+      this.deploymentType = initDeploymentType(mergedStereotypes, annotatedItem, xmlAnnotatedItem, container);
+      this.scopeType = initScopeType(mergedStereotypes, annotatedItem, xmlAnnotatedItem);
+      this.name = initName(getMergedStereotypes(), annotatedItem, xmlAnnotatedItem, getType());
+      checkRequiredTypesImplemented(getMergedStereotypes(), getType());
+      checkScopeAllowed(getMergedStereotypes(), getScopeType(), getType());
+      // TODO This is too high
+      checkComponentImplementation(getType());
+      // TODO Interceptors
+   }
+   
+   @SuppressWarnings("unchecked")
+   protected static Class<?> initType(AnnotatedType annotatedItem, AnnotatedType xmlAnnotatedItem)
+   {
+      if (annotatedItem.getAnnotatedClass() != null && xmlAnnotatedItem.getAnnotatedClass() != null && !annotatedItem.getAnnotatedClass().equals(xmlAnnotatedItem.getAnnotatedClass()))
+      {
+         throw new IllegalArgumentException("Cannot build a component which specifies different classes in XML and Java");
+      }
+      else if (xmlAnnotatedItem.getAnnotatedClass() != null)
+      {
+         log.finest("Component type specified in XML");
+         return xmlAnnotatedItem.getAnnotatedClass();
+      }
+      else if (annotatedItem.getAnnotatedClass() != null)
+      {
+         log.finest("Component type specified in Java");
+         return annotatedItem.getAnnotatedClass();
+      }
+      else
+      {
+         throw new IllegalArgumentException("Cannot build a component which doesn't specify a type");
+      }
+   }
+   
+   protected static Annotation initDeploymentType(MergedStereotypesModel stereotypes, AnnotatedType annotatedItem, AnnotatedType xmlAnnotatedItem, ContainerImpl container)
+   {
+      Set<Annotation> xmlDeploymentTypes = xmlAnnotatedItem.getAnnotations(DeploymentType.class);
+      
+      if (xmlDeploymentTypes.size() > 1)
+      {
+         throw new RuntimeException("At most one deployment type may be specified (" + xmlDeploymentTypes + " are specified)");
+      }
+      
+      if (xmlDeploymentTypes.size() == 1)
+      {
+         Annotation deploymentType = xmlDeploymentTypes.iterator().next(); 
+         log.finest("Deployment type " + deploymentType + " specified in XML");
+         return deploymentType;
+      }
+      
+      if (xmlAnnotatedItem.getAnnotatedClass() == null)
+      {
+      
+         Set<Annotation> deploymentTypes = annotatedItem.getAnnotations(DeploymentType.class);
+         
+         if (deploymentTypes.size() > 1)
+         {
+            throw new RuntimeException("At most one deployment type may be specified (" + deploymentTypes + " are specified) on " + annotatedItem.getAnnotatedClass());
+         }
+         if (deploymentTypes.size() == 1)
+         {
+            Annotation deploymentType = deploymentTypes.iterator().next();
+            log.finest("Deployment type " + deploymentType + " specified by annotation");
+            return deploymentType;
+         }
+      }
+      
+      if (stereotypes.getPossibleDeploymentTypes().size() > 0)
+      {
+         Annotation deploymentType = getDeploymentType(container.getEnabledDeploymentTypes(), stereotypes.getPossibleDeploymentTypes());
+         log.finest("Deployment type " + deploymentType + " specified by stereotype");
+         return deploymentType;
+      }
+      
+      if (xmlAnnotatedItem.getAnnotatedClass() != null)
+      {
+         log.finest("Using default @Production deployment type");
+         return new ProductionBinding();
+      }
+      throw new RuntimeException("All Java annotated classes have a deployment type");
+   }
+   
+   /**
+    * Return the scope of the component
+    */
+   protected static Annotation initScopeType(MergedStereotypesModel stereotypes, AnnotatedItem annotatedItem, AnnotatedItem xmlAnnotatedItem)
+   {
+      Set<Annotation> xmlScopes = xmlAnnotatedItem.getAnnotations(ScopeType.class);
+      if (xmlScopes.size() > 1)
+      {
+         throw new RuntimeException("At most one scope may be specified in XML");
+      }
+      
+      if (xmlScopes.size() == 1)
+      {
+         Annotation scope = xmlScopes.iterator().next();
+         log.finest("Scope " + scope + " specified in XML");
+         return scope;
+      }
+      
+      Set<Annotation> scopes = annotatedItem.getAnnotations(ScopeType.class);
+      if (scopes.size() > 1)
+      {
+         throw new RuntimeException("At most one scope may be specified");
+      }
+      
+      if (scopes.size() == 1)
+      {
+         Annotation scope = scopes.iterator().next();
+         log.finest("Scope " + scope + " specified b annotation");
+         return scope;
+      }
+      
+      if (stereotypes.getPossibleScopeTypes().size() == 1)
+      {
+         Annotation scope = stereotypes.getPossibleScopeTypes().iterator().next();
+         log.finest("Scope " + scope + " specified by stereotype");
+         return scope;
+      }
+      else if (stereotypes.getPossibleScopeTypes().size() > 1)
+      {
+         throw new RuntimeException("All stereotypes must specify the same scope OR a scope must be specified on the component");
+      }
+      
+      log.finest("Using default @Dependent scope");
+      return new DependentBinding();
+   }
+   
+   public static Annotation getDeploymentType(List<Annotation> enabledDeploymentTypes, Map<Class<? extends Annotation>, Annotation> possibleDeploymentTypes)
+   {
+      for (int i = (enabledDeploymentTypes.size() - 1); i > 0; i--)
+      {
+         if (possibleDeploymentTypes.containsKey((enabledDeploymentTypes.get(i).annotationType())))
+         {
+            return enabledDeploymentTypes.get(i); 
+         }
+      }
+      return null;
+   }
+   
+   protected static String initName(MergedStereotypesModel stereotypes, AnnotatedItem annotatedItem, AnnotatedItem xmlAnnotatedItem, Class<?> type)
+   {
+      boolean componentNameDefaulted = false;
+      String name = null;
+      if (xmlAnnotatedItem.isAnnotationPresent(Named.class))
+      {
+         name = xmlAnnotatedItem.getAnnotation(Named.class).value();
+         if ("".equals(name))
+         {
+            log.finest("Using default name (specified in XML)");
+            componentNameDefaulted = true;
+         }
+         else
+         {
+            log.finest("Using name " + name + " specified in XML");
+         }
+      }
+      else if (annotatedItem.isAnnotationPresent(Named.class))
+      {
+         name = annotatedItem.getAnnotation(Named.class).value();
+         if ("".equals(name))
+         {
+            log.finest("Using default name (specified by annotations)");
+            componentNameDefaulted = true;
+         }
+         else
+         {
+            log.finest("Using name " + name + " specified in XML");
+         }
+      }
+      if ("".equals(name) && (componentNameDefaulted || stereotypes.isComponentNameDefaulted()))
+      {
+          name = Strings.decapitalize(type.getSimpleName());
+         log.finest("Default name of " + type + " is " + name );
+      }
+      return name;
+   }
+   
+   /**
+    * Check that the types required by the stereotypes on the component are implemented
+    */
+   protected static void checkRequiredTypesImplemented(MergedStereotypesModel stereotypes, Class<?> type)
+   {
+      for (Class<?> requiredType : stereotypes.getRequiredTypes())
+      {
+         log.finest("Checking if required type " + requiredType + " is implemented");
+         if (!requiredType.isAssignableFrom(type))
+         {
+            throw new RuntimeException("Required type " + requiredType + " isn't implemented on " + type);
+         }
+      }
+   }
+   
+   /**
+    * Check that the scope type is allowed by the stereotypes on the component and the component type
+    * @param type 
+    */
+   protected static void checkScopeAllowed(MergedStereotypesModel stereotypes, Annotation scopeType, Class<?> type)
+   {
+      log.finest("Checking if " + scopeType + " is allowed for " + type);
+      if (stereotypes.getSupportedScopes().size() > 0)
+      {
+         if (!stereotypes.getSupportedScopes().contains(scopeType.annotationType()))
+         {
+            throw new RuntimeException("Scope " + scopeType + " is not an allowed by the stereotype for " + type);
+         }
+      }
+      if (isDeclaredFinal(type) && !scopeType.annotationType().equals(Dependent.class))
+      {
+         throw new RuntimeException("Scope " + scopeType + " is not allowed as the class is declared final or has methods declared final for " + type + ". Only @Dependent is allowed for final components");
+      }
+   }
+   
+   protected static boolean isDeclaredFinal(Class<?> type)
+   {
+      if (Reflections.isFinal(type))
+      {
+         return true;
+      }
+      for (Method method : type.getDeclaredMethods())
+      {
+         if (Reflections.isFinal(method))
+         {
+            return true;
+         }
+      }
+      return false;
+   }
+   
+   protected static <T> InjectableMethod<?> initRemoveMethod(EjbMetaData<T> ejbMetaData, Class<? extends T> type)
+   {
+      if (ejbMetaData.isStateful())
+      {
+         if (ejbMetaData.getRemoveMethods().size() == 1)
+         {
+            return new InjectableMethod<Object>(ejbMetaData.getRemoveMethods().get(0));
+         }
+         else if (ejbMetaData.getRemoveMethods().size() > 1)
+         {
+            List<Method> possibleRemoveMethods = new ArrayList<Method>();
+            for (Method removeMethod : ejbMetaData.getRemoveMethods())
+            {
+               if (removeMethod.isAnnotationPresent(Destroys.class))
+               {
+                  possibleRemoveMethods.add(removeMethod);
+               }
+            }
+            if (possibleRemoveMethods.size() == 1)
+            {
+               return new InjectableMethod<Object>(possibleRemoveMethods.get(0)); 
+            }
+            else if (possibleRemoveMethods.size() > 1)
+            {
+               throw new RuntimeException("Multiple remove methods are annotated @Destroys for " + type);
+            }
+            else if (possibleRemoveMethods.size() == 0)
+            {
+               throw new RuntimeException("Multiple remove methods are declared, and none are annotated @Destroys for " + type);
+            }
+         }
+         else if (ejbMetaData.getRemoveMethods().size() == 0)
+         {
+            throw new RuntimeException("Stateful enterprise bean component has no remove methods declared for " + type);
+         }
+      }
+      else
+      {
+         List<Method> destroysMethods = Reflections.getMethods(type, Destroys.class);
+         if (destroysMethods.size() > 0)
+         {
+            throw new RuntimeException("Only stateful enterprise bean components can have methods annotated @Destroys; " + type + " is not a stateful enterprise bean component");
+         }
+      }
+      return null;
+   }
+   
+   protected static void checkComponentImplementation(Class<?> type)
+   {
+      if (Reflections.isAbstract(type))
+      {
+         throw new RuntimeException("Web Bean implementation class " + type + " cannot be declared abstract");
+      }
+   }
+
+   public Annotation getDeploymentType()
+   {
+      return deploymentType;
+   }
+
+   public String getName()
+   {
+      return name;
+   }
+   
+   @Override
+   public Annotation getScopeType()
+   {
+      return scopeType;
+   }
+
+   protected MergedStereotypesModel getMergedStereotypes()
+   {
+      return mergedStereotypes;
+   }
+   
+   protected Class<? extends T> getType()
+   {
+      return type;
+   }
+   
+   public Set<Annotation> getBindingTypes()
+   {
+      return bindingTypes;
+   }
+
+}


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

Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractComponentModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractComponentModel.java	2008-08-10 15:36:43 UTC (rev 94)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractComponentModel.java	2008-08-11 16:32:44 UTC (rev 95)
@@ -1,425 +0,0 @@
-package org.jboss.webbeans.model;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.logging.Logger;
-
-import javax.webbeans.BindingType;
-import javax.webbeans.Dependent;
-import javax.webbeans.DeploymentType;
-import javax.webbeans.Destroys;
-import javax.webbeans.Named;
-import javax.webbeans.ScopeType;
-
-import org.jboss.webbeans.ContainerImpl;
-import org.jboss.webbeans.bindings.CurrentBinding;
-import org.jboss.webbeans.bindings.DependentBinding;
-import org.jboss.webbeans.bindings.ProductionBinding;
-import org.jboss.webbeans.ejb.EjbMetaData;
-import org.jboss.webbeans.injectable.ComponentConstructor;
-import org.jboss.webbeans.injectable.InjectableMethod;
-import org.jboss.webbeans.util.AnnotatedItem;
-import org.jboss.webbeans.util.LoggerUtil;
-import org.jboss.webbeans.util.Reflections;
-import org.jboss.webbeans.util.Strings;
-
-
-
-/**
- * Web Beans Component meta model
- * 
- * @author Pete Muir
- * 
- */
-public abstract class AbstractComponentModel<T>
-{
-
-   public static final String LOGGER_NAME = "componentMetaModel";
-   
-   private static Logger log = LoggerUtil.getLogger(LOGGER_NAME);
-   
-   private Class<? extends T> type;
-   private Set<Annotation> bindingTypes;
-   private Annotation deploymentType;
-   private Annotation scopeType;
-   private MergedStereotypesModel mergedStereotypes;
-
-   private String name;
-   
-   /**
-    * 
-    * @param annotatedItem Annotations read from java classes
-    * @param xmlAnnotatedItem Annotations read from XML
-    * @param container
-    */
-   @SuppressWarnings("unchecked")
-   public AbstractComponentModel(AnnotatedItem annotatedItem, AnnotatedItem xmlAnnotatedItem, ContainerImpl container)
-   {
-      if (annotatedItem == null)
-      {
-         throw new NullPointerException("annotatedItem must not be null. If the component is declared just in XML, pass in an empty annotatedItem");
-      }
-      
-      if (xmlAnnotatedItem == null)
-      {
-         throw new NullPointerException("xmlAnnotatedItem must not be null. If the component is declared just in Java, pass in an empty xmlAnnotatedItem");
-      }
-      
-      this.type = (Class<? extends T>) initType(annotatedItem, xmlAnnotatedItem);
-      log.fine("Building Web Bean component metadata for " +  type);
-      mergedStereotypes = new MergedStereotypesModel(annotatedItem, xmlAnnotatedItem, container);
-      this.bindingTypes = initBindingTypes(annotatedItem, xmlAnnotatedItem);
-      this.deploymentType = initDeploymentType(mergedStereotypes, annotatedItem, xmlAnnotatedItem, container);
-      this.scopeType = initScopeType(mergedStereotypes, annotatedItem, xmlAnnotatedItem);
-      this.name = initName(getMergedStereotypes(), annotatedItem, xmlAnnotatedItem, type);
-      checkRequiredTypesImplemented(getMergedStereotypes(), type);
-      checkScopeAllowed(getMergedStereotypes(), getScopeType(), type);
-      checkComponentImplementation(type);
-      // TODO Interceptors
-   }
-   
-   public AbstractComponentModel()
-   {
-      // TODO Auto-generated constructor stub
-   }
-   
-   @SuppressWarnings("unchecked")
-   protected static Class<?> initType(AnnotatedItem annotatedItem, AnnotatedItem xmlAnnotatedItem)
-   {
-      if (annotatedItem.getAnnotatedClass() != null && xmlAnnotatedItem.getAnnotatedClass() != null && !annotatedItem.getAnnotatedClass().equals(xmlAnnotatedItem.getAnnotatedClass()))
-      {
-         throw new IllegalArgumentException("Cannot build a component which specifies different classes in XML and Java");
-      }
-      else if (xmlAnnotatedItem.getAnnotatedClass() != null)
-      {
-         log.finest("Component type specified in XML");
-         return xmlAnnotatedItem.getAnnotatedClass();
-      }
-      else if (annotatedItem.getAnnotatedClass() != null)
-      {
-         log.finest("Component type specified in Java");
-         return annotatedItem.getAnnotatedClass();
-      }
-      else
-      {
-         throw new IllegalArgumentException("Cannot build a component which doesn't specify a type");
-      }
-   }
-   
-   protected static Set<Annotation> initBindingTypes(AnnotatedItem annotatedItem, AnnotatedItem xmlAnnotatedItem)
-   {
-      Set<Annotation> xmlBindingTypes = xmlAnnotatedItem.getAnnotations(BindingType.class);
-      if (xmlBindingTypes.size() > 0)
-      {
-         // TODO support producer expression default binding type
-         log.finest("Using binding types " + xmlBindingTypes + " specified in XML");
-         return xmlBindingTypes;
-      }
-      
-      Set<Annotation> bindingTypes = annotatedItem.getAnnotations(BindingType.class);
-      
-      if (bindingTypes.size() == 0)
-      {
-         log.finest("Adding default @Current binding type");
-         bindingTypes.add(new CurrentBinding());
-      }
-      else
-      {
-         log.finest("Using binding types " + bindingTypes + " specified by annotations");
-      }
-      return bindingTypes;
-   }
-   
-   protected static Annotation initDeploymentType(MergedStereotypesModel stereotypes, AnnotatedItem annotatedItem, AnnotatedItem xmlAnnotatedItem, ContainerImpl container)
-   {
-      Set<Annotation> xmlDeploymentTypes = xmlAnnotatedItem.getAnnotations(DeploymentType.class);
-      
-      if (xmlDeploymentTypes.size() > 1)
-      {
-         throw new RuntimeException("At most one deployment type may be specified (" + xmlDeploymentTypes + " are specified)");
-      }
-      
-      if (xmlDeploymentTypes.size() == 1)
-      {
-         Annotation deploymentType = xmlDeploymentTypes.iterator().next(); 
-         log.finest("Deployment type " + deploymentType + " specified in XML");
-         return deploymentType;
-      }
-      
-      if (xmlAnnotatedItem.getAnnotatedClass() == null)
-      {
-      
-         Set<Annotation> deploymentTypes = annotatedItem.getAnnotations(DeploymentType.class);
-         
-         if (deploymentTypes.size() > 1)
-         {
-            throw new RuntimeException("At most one deployment type may be specified (" + deploymentTypes + " are specified) on " + annotatedItem.getAnnotatedClass());
-         }
-         if (deploymentTypes.size() == 1)
-         {
-            Annotation deploymentType = deploymentTypes.iterator().next();
-            log.finest("Deployment type " + deploymentType + " specified by annotation");
-            return deploymentType;
-         }
-      }
-      
-      if (stereotypes.getPossibleDeploymentTypes().size() > 0)
-      {
-         Annotation deploymentType = getDeploymentType(container.getEnabledDeploymentTypes(), stereotypes.getPossibleDeploymentTypes());
-         log.finest("Deployment type " + deploymentType + " specified by stereotype");
-         return deploymentType;
-      }
-      
-      if (xmlAnnotatedItem.getAnnotatedClass() != null)
-      {
-         log.finest("Using default @Production deployment type");
-         return new ProductionBinding();
-      }
-      throw new RuntimeException("All Java annotated classes have a deployment type");
-   }
-   
-   /**
-    * Return the scope of the component
-    */
-   protected static Annotation initScopeType(MergedStereotypesModel stereotypes, AnnotatedItem annotatedItem, AnnotatedItem xmlAnnotatedItem)
-   {
-      Set<Annotation> xmlScopes = xmlAnnotatedItem.getAnnotations(ScopeType.class);
-      if (xmlScopes.size() > 1)
-      {
-         throw new RuntimeException("At most one scope may be specified in XML");
-      }
-      
-      if (xmlScopes.size() == 1)
-      {
-         Annotation scope = xmlScopes.iterator().next();
-         log.finest("Scope " + scope + " specified in XML");
-         return scope;
-      }
-      
-      Set<Annotation> scopes = annotatedItem.getAnnotations(ScopeType.class);
-      if (scopes.size() > 1)
-      {
-         throw new RuntimeException("At most one scope may be specified");
-      }
-      
-      if (scopes.size() == 1)
-      {
-         Annotation scope = scopes.iterator().next();
-         log.finest("Scope " + scope + " specified b annotation");
-         return scope;
-      }
-      
-      if (stereotypes.getPossibleScopeTypes().size() == 1)
-      {
-         Annotation scope = stereotypes.getPossibleScopeTypes().iterator().next();
-         log.finest("Scope " + scope + " specified by stereotype");
-         return scope;
-      }
-      else if (stereotypes.getPossibleScopeTypes().size() > 1)
-      {
-         throw new RuntimeException("All stereotypes must specify the same scope OR a scope must be specified on the component");
-      }
-      
-      log.finest("Using default @Dependent scope");
-      return new DependentBinding();
-   }
-   
-   public static Annotation getDeploymentType(List<Annotation> enabledDeploymentTypes, Map<Class<? extends Annotation>, Annotation> possibleDeploymentTypes)
-   {
-      for (int i = (enabledDeploymentTypes.size() - 1); i > 0; i--)
-      {
-         if (possibleDeploymentTypes.containsKey((enabledDeploymentTypes.get(i).annotationType())))
-         {
-            return enabledDeploymentTypes.get(i); 
-         }
-      }
-      return null;
-   }
-   
-   protected static String initName(MergedStereotypesModel stereotypes, AnnotatedItem annotatedItem, AnnotatedItem xmlAnnotatedItem, Class<?> type)
-   {
-      boolean componentNameDefaulted = false;
-      String name = null;
-      if (xmlAnnotatedItem.isAnnotationPresent(Named.class))
-      {
-         name = xmlAnnotatedItem.getAnnotation(Named.class).value();
-         if ("".equals(name))
-         {
-            log.finest("Using default name (specified in XML)");
-            componentNameDefaulted = true;
-         }
-         else
-         {
-            log.finest("Using name " + name + " specified in XML");
-         }
-      }
-      else if (annotatedItem.isAnnotationPresent(Named.class))
-      {
-         name = annotatedItem.getAnnotation(Named.class).value();
-         if ("".equals(name))
-         {
-            log.finest("Using default name (specified by annotations)");
-            componentNameDefaulted = true;
-         }
-         else
-         {
-            log.finest("Using name " + name + " specified in XML");
-         }
-      }
-      if ("".equals(name) && (componentNameDefaulted || stereotypes.isComponentNameDefaulted()))
-      {
-          name = Strings.decapitalize(type.getSimpleName());
-         log.finest("Default name of " + type + " is " + name );
-      }
-      return name;
-   }
-   
-   /**
-    * Check that the types required by the stereotypes on the component are implemented
-    */
-   protected static void checkRequiredTypesImplemented(MergedStereotypesModel stereotypes, Class<?> type)
-   {
-      for (Class<?> requiredType : stereotypes.getRequiredTypes())
-      {
-         log.finest("Checking if required type " + requiredType + " is implemented");
-         if (!requiredType.isAssignableFrom(type))
-         {
-            throw new RuntimeException("Required type " + requiredType + " isn't implemented on " + type);
-         }
-      }
-   }
-   
-   /**
-    * Check that the scope type is allowed by the stereotypes on the component and the component type
-    * @param type 
-    */
-   protected static void checkScopeAllowed(MergedStereotypesModel stereotypes, Annotation scopeType, Class<?> type)
-   {
-      log.finest("Checking if " + scopeType + " is allowed for " + type);
-      if (stereotypes.getSupportedScopes().size() > 0)
-      {
-         if (!stereotypes.getSupportedScopes().contains(scopeType.annotationType()))
-         {
-            throw new RuntimeException("Scope " + scopeType + " is not an allowed by the stereotype for " + type);
-         }
-      }
-      if (isDeclaredFinal(type) && !scopeType.annotationType().equals(Dependent.class))
-      {
-         throw new RuntimeException("Scope " + scopeType + " is not allowed as the class is declared final or has methods declared final for " + type + ". Only @Dependent is allowed for final components");
-      }
-   }
-   
-   protected static boolean isDeclaredFinal(Class<?> type)
-   {
-      if (Reflections.isFinal(type))
-      {
-         return true;
-      }
-      for (Method method : type.getDeclaredMethods())
-      {
-         if (Reflections.isFinal(method))
-         {
-            return true;
-         }
-      }
-      return false;
-   }
-   
-   protected static <T> InjectableMethod<?> initRemoveMethod(EjbMetaData<T> ejbMetaData, Class<? extends T> type)
-   {
-      if (ejbMetaData.isStateful())
-      {
-         if (ejbMetaData.getRemoveMethods().size() == 1)
-         {
-            return new InjectableMethod<Object>(ejbMetaData.getRemoveMethods().get(0));
-         }
-         else if (ejbMetaData.getRemoveMethods().size() > 1)
-         {
-            List<Method> possibleRemoveMethods = new ArrayList<Method>();
-            for (Method removeMethod : ejbMetaData.getRemoveMethods())
-            {
-               if (removeMethod.isAnnotationPresent(Destroys.class))
-               {
-                  possibleRemoveMethods.add(removeMethod);
-               }
-            }
-            if (possibleRemoveMethods.size() == 1)
-            {
-               return new InjectableMethod<Object>(possibleRemoveMethods.get(0)); 
-            }
-            else if (possibleRemoveMethods.size() > 1)
-            {
-               throw new RuntimeException("Multiple remove methods are annotated @Destroys for " + type);
-            }
-            else if (possibleRemoveMethods.size() == 0)
-            {
-               throw new RuntimeException("Multiple remove methods are declared, and none are annotated @Destroys for " + type);
-            }
-         }
-         else if (ejbMetaData.getRemoveMethods().size() == 0)
-         {
-            throw new RuntimeException("Stateful enterprise bean component has no remove methods declared for " + type);
-         }
-      }
-      else
-      {
-         List<Method> destroysMethods = Reflections.getMethods(type, Destroys.class);
-         if (destroysMethods.size() > 0)
-         {
-            throw new RuntimeException("Only stateful enterprise bean components can have methods annotated @Destroys; " + type + " is not a stateful enterprise bean component");
-         }
-      }
-      return null;
-   }
-   
-   protected static void checkComponentImplementation(Class<?> type)
-   {
-      if (Reflections.isAbstract(type))
-      {
-         throw new RuntimeException("Web Bean implementation class " + type + " cannot be declared abstract");
-      }
-   }
-
-   public Set<Annotation> getBindingTypes()
-   {
-      return bindingTypes;
-   }
-
-   public Annotation getDeploymentType()
-   {
-      return deploymentType;
-   }
-
-   public String getName()
-   {
-      return name;
-   }
-
-   public Annotation getScopeType()
-   {
-      return scopeType;
-   }
-   
-   protected Class<? extends T> getType()
-   {
-      return type;
-   }
-   
-   protected MergedStereotypesModel getMergedStereotypes()
-   {
-      return mergedStereotypes;
-   }
-   
-   public abstract ComponentConstructor<T> getConstructor();
-   
-   @Override
-   public String toString()
-   {
-      return "SimpleComponentModel[" + type.getName() + "]";
-   }
-
-}

Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractComponentModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractComponentModel.java	                        (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AbstractComponentModel.java	2008-08-11 16:32:44 UTC (rev 95)
@@ -0,0 +1,57 @@
+package org.jboss.webbeans.model;
+
+import java.lang.annotation.Annotation;
+import java.util.Set;
+import java.util.logging.Logger;
+
+import javax.webbeans.BindingType;
+
+import org.jboss.webbeans.bindings.CurrentBinding;
+import org.jboss.webbeans.injectable.ComponentConstructor;
+import org.jboss.webbeans.introspector.AnnotatedItem;
+import org.jboss.webbeans.util.LoggerUtil;
+
+public abstract class AbstractComponentModel<T>
+{
+   
+   public static final String LOGGER_NAME = "componentModel";
+   
+   private static Logger log = LoggerUtil.getLogger(LOGGER_NAME);
+
+   protected static Set<Annotation> initBindingTypes(AnnotatedItem annotatedItem, AnnotatedItem xmlAnnotatedItem)
+   {
+      Set<Annotation> xmlBindingTypes = xmlAnnotatedItem.getAnnotations(BindingType.class);
+      if (xmlBindingTypes.size() > 0)
+      {
+         // TODO support producer expression default binding type
+         log.finest("Using binding types " + xmlBindingTypes + " specified in XML");
+         return xmlBindingTypes;
+      }
+      
+      Set<Annotation> bindingTypes = annotatedItem.getAnnotations(BindingType.class);
+      
+      if (bindingTypes.size() == 0)
+      {
+         log.finest("Adding default @Current binding type");
+         bindingTypes.add(new CurrentBinding());
+      }
+      else
+      {
+         log.finest("Using binding types " + bindingTypes + " specified by annotations");
+      }
+      return bindingTypes;
+   }
+
+   public abstract Set<Annotation> getBindingTypes();
+
+   public abstract Annotation getScopeType();
+
+   protected abstract Class<? extends T> getType();
+
+   public abstract ComponentConstructor<T> getConstructor();
+
+   public abstract Annotation getDeploymentType();
+
+   public abstract String getName();
+
+}
\ No newline at end of file

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/EnterpriseComponentModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/EnterpriseComponentModel.java	2008-08-10 15:36:43 UTC (rev 94)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/EnterpriseComponentModel.java	2008-08-11 16:32:44 UTC (rev 95)
@@ -10,16 +10,16 @@
 import org.jboss.webbeans.injectable.ComponentConstructor;
 import org.jboss.webbeans.injectable.EnterpriseConstructor;
 import org.jboss.webbeans.injectable.InjectableMethod;
-import org.jboss.webbeans.util.AnnotatedItem;
+import org.jboss.webbeans.introspector.AnnotatedType;
 
-public class EnterpriseComponentModel<T> extends AbstractComponentModel<T>
+public class EnterpriseComponentModel<T> extends AbstractClassComponentModel<T>
 {
 
    private EnterpriseConstructor<T> constructor;
    private InjectableMethod<?> removeMethod;  
    
-   public EnterpriseComponentModel(AnnotatedItem annotatedItem,
-         AnnotatedItem xmlAnnotatedItem, ContainerImpl container)
+   public EnterpriseComponentModel(AnnotatedType annotatedItem,
+         AnnotatedType xmlAnnotatedItem, ContainerImpl container)
    {
       super(annotatedItem, xmlAnnotatedItem, container);
       EjbMetaData<T> ejbMetaData = container.getEjbManager().getEjbMetaData(getType());

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/JmsComponentModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/JmsComponentModel.java	2008-08-10 15:36:43 UTC (rev 94)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/JmsComponentModel.java	2008-08-11 16:32:44 UTC (rev 95)
@@ -9,42 +9,39 @@
 import javax.webbeans.ScopeType;
 
 import org.jboss.webbeans.ContainerImpl;
-import org.jboss.webbeans.bindings.DependentBinding;
 import org.jboss.webbeans.injectable.ComponentConstructor;
 import org.jboss.webbeans.injectable.JMSConstructor;
-import org.jboss.webbeans.util.AnnotatedItem;
-import org.jboss.webbeans.util.MutableAnnotatedItem;
+import org.jboss.webbeans.introspector.AnnotatedItem;
+import org.jboss.webbeans.introspector.SimpleAnnotatedItem;
 import org.jboss.webbeans.util.Reflections;
 
+// TODO Work out what to return on methods we don't support
+
 public class JmsComponentModel<T> extends AbstractComponentModel<T>
 {
 
    // TODO Work out how to handle xml elements which don't correspond to annotations
    
+   private String jndiName;
+   private ComponentConstructor<T> constructor;
    private Set<Annotation> bindingTypes;
-   private Class<? extends T> type;
    private Annotation scopeType;
-   private String jndiName;
-   private ComponentConstructor<T> constructor;
    
    @SuppressWarnings("unchecked")
    public JmsComponentModel(AnnotatedItem xmlAnnotatedItem, ContainerImpl container)
    {
-      AnnotatedItem annotatedItem = new MutableAnnotatedItem(null, new HashMap<Class<? extends Annotation>, Annotation>());
-      type = (Class<? extends T>)initType(xmlAnnotatedItem);
+      AnnotatedItem annotatedItem = new SimpleAnnotatedItem(new HashMap<Class<? extends Annotation>, Annotation>());
       bindingTypes = initBindingTypes(annotatedItem, xmlAnnotatedItem);
-      scopeType = new DependentBinding();
-      checkBindingTypesAllowed(bindingTypes, type);
-      checkScopeAllowed(xmlAnnotatedItem, type);
+      //scopeType = new DependentBiding();
+      checkBindingTypesAllowed(bindingTypes, null);
+      checkScopeAllowed(xmlAnnotatedItem, null);
       // TODO Initialize queue. topic
       this.constructor = new JMSConstructor<T>(jndiName);
    }
-   
-   
 
    @SuppressWarnings("unchecked")
    protected static void checkBindingTypesAllowed(Set<Annotation> bindingTypes,
-         Class<?> type)
+         String type)
    {
       if (bindingTypes.size() == 0)
       {
@@ -87,7 +84,7 @@
    @Override
    protected Class<? extends T> getType()
    {
-      return type;
+      return null;
    }
    
    public String getJndiName()
@@ -100,5 +97,17 @@
    {
       return scopeType;
    }
+
+   @Override
+   public Annotation getDeploymentType()
+   {
+      return null;
+   }
+
+   @Override
+   public String getName()
+   {
+      return null;
+   }
    
 }

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/MergedStereotypesModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/MergedStereotypesModel.java	2008-08-10 15:36:43 UTC (rev 94)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/MergedStereotypesModel.java	2008-08-11 16:32:44 UTC (rev 95)
@@ -9,7 +9,7 @@
 import javax.webbeans.Stereotype;
 
 import org.jboss.webbeans.ContainerImpl;
-import org.jboss.webbeans.util.AnnotatedItem;
+import org.jboss.webbeans.introspector.AnnotatedItem;
 
 /**
  * Meta model for the merged stereotype for a component

Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/ProducerMethodComponentModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/ProducerMethodComponentModel.java	                        (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/ProducerMethodComponentModel.java	2008-08-11 16:32:44 UTC (rev 95)
@@ -0,0 +1,72 @@
+package org.jboss.webbeans.model;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Modifier;
+import java.util.Set;
+
+import org.jboss.webbeans.ContainerImpl;
+import org.jboss.webbeans.injectable.ComponentConstructor;
+import org.jboss.webbeans.introspector.AnnotatedMethod;
+
+public class ProducerMethodComponentModel<T> extends AbstractComponentModel<T>
+{
+   
+   @SuppressWarnings("unchecked")
+   public ProducerMethodComponentModel(AnnotatedMethod annotatedItem, ContainerImpl container)
+   {
+      checkProducerMethod(annotatedItem, container);
+   }
+
+   @Override
+   public ComponentConstructor getConstructor()
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+   
+   public static void checkProducerMethod(AnnotatedMethod annotatedItem, ContainerImpl container)
+   {
+      if (Modifier.isStatic(annotatedItem.getAnnotatedMethod().getModifiers()))
+      {
+         throw new RuntimeException("Producer method cannot be static " + annotatedItem);
+      }
+      // TODO Check if declaring class is a WB component
+      
+   }
+
+   @Override
+   public Set<Annotation> getBindingTypes()
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+   @Override
+   public Annotation getDeploymentType()
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+   @Override
+   public String getName()
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+   @Override
+   public Annotation getScopeType()
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+   @Override
+   protected Class<? extends T> getType()
+   {
+      // TODO Auto-generated method stub
+      return null;
+   }
+
+}


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

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/RemoteComponentModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/RemoteComponentModel.java	2008-08-10 15:36:43 UTC (rev 94)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/RemoteComponentModel.java	2008-08-11 16:32:44 UTC (rev 95)
@@ -11,17 +11,18 @@
 import org.jboss.webbeans.injectable.ComponentConstructor;
 import org.jboss.webbeans.injectable.EnterpriseConstructor;
 import org.jboss.webbeans.injectable.InjectableMethod;
-import org.jboss.webbeans.util.AnnotatedItem;
+import org.jboss.webbeans.introspector.AnnotatedItem;
+import org.jboss.webbeans.introspector.AnnotatedType;
 
-public class RemoteComponentModel<T> extends AbstractComponentModel<T>
+public class RemoteComponentModel<T> extends AbstractClassComponentModel<T>
 {
    
    private EnterpriseConstructor<T> constructor;
    private InjectableMethod<?> removeMethod;
    private String boundTo;
    
-   public RemoteComponentModel(AnnotatedItem annotatedItem,
-         AnnotatedItem xmlAnnotatedItem, ContainerImpl container)
+   public RemoteComponentModel(AnnotatedType annotatedItem,
+         AnnotatedType xmlAnnotatedItem, ContainerImpl container)
    {
       super(annotatedItem, xmlAnnotatedItem, container);
       EjbMetaData<T> ejbMetaData = container.getEjbManager().getEjbMetaData(getType());

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/SimpleComponentModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/SimpleComponentModel.java	2008-08-10 15:36:43 UTC (rev 94)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/SimpleComponentModel.java	2008-08-11 16:32:44 UTC (rev 95)
@@ -10,11 +10,11 @@
 import org.jboss.webbeans.ContainerImpl;
 import org.jboss.webbeans.injectable.SimpleConstructor;
 import org.jboss.webbeans.injectable.InjectableMethod;
-import org.jboss.webbeans.util.AnnotatedItem;
+import org.jboss.webbeans.introspector.AnnotatedType;
 import org.jboss.webbeans.util.LoggerUtil;
 import org.jboss.webbeans.util.Reflections;
 
-public class SimpleComponentModel<T> extends AbstractComponentModel<T>
+public class SimpleComponentModel<T> extends AbstractClassComponentModel<T>
 {
    
    public static final String LOGGER_NAME = "componentMetaModel";
@@ -31,10 +31,11 @@
     * @param container
     */
    @SuppressWarnings("unchecked")
-   public SimpleComponentModel(AnnotatedItem annotatedItem, AnnotatedItem xmlAnnotatedItem, ContainerImpl container)
+   public SimpleComponentModel(AnnotatedType annotatedItem, AnnotatedType xmlAnnotatedItem, ContainerImpl container)
    {
       super(annotatedItem, xmlAnnotatedItem, container);
       this.constructor = initConstructor(getType());
+      checkType(getType());
       // TODO Interceptors
    }
    
@@ -111,6 +112,13 @@
    {
       return removeMethod;
    }
+   
 
+   @Override
+   public String toString()
+   {
+      return "SimpleComponentModel[" + getType().getName() + "]";
+   }
+
    
 }

Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/StereotypeModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/StereotypeModel.java	2008-08-10 15:36:43 UTC (rev 94)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/StereotypeModel.java	2008-08-11 16:32:44 UTC (rev 95)
@@ -12,7 +12,8 @@
 import javax.webbeans.ScopeType;
 import javax.webbeans.Stereotype;
 
-import org.jboss.webbeans.util.AnnotatedItem;
+import org.jboss.webbeans.introspector.AnnotatedItem;
+import org.jboss.webbeans.introspector.AnnotatedType;
 
 /**
  * A meta model for a stereotype, allows us to cache a stereotype and to validate it
@@ -32,7 +33,7 @@
    private Set<Annotation> interceptorBindings;
    
    @SuppressWarnings("unchecked")
-   public StereotypeModel(AnnotatedItem annotatedClass)
+   public StereotypeModel(AnnotatedType annotatedClass)
    {
       initStereotypeClass(annotatedClass);
       Stereotype stereotype = annotatedClass.getAnnotation(Stereotype.class);
@@ -55,7 +56,7 @@
    }
    
    @SuppressWarnings("unchecked")
-   private void initStereotypeClass(AnnotatedItem annotatedClass)
+   private void initStereotypeClass(AnnotatedType annotatedClass)
    {
       if (Annotation.class.isAssignableFrom(annotatedClass.getAnnotatedClass()))
       {

Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/AbstractAnnotatedItem.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/AbstractAnnotatedItem.java	2008-08-10 15:36:43 UTC (rev 94)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/AbstractAnnotatedItem.java	2008-08-11 16:32:44 UTC (rev 95)
@@ -1,107 +0,0 @@
-package org.jboss.webbeans.util;
-
-import java.lang.annotation.Annotation;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.Map.Entry;
-
-/**
- * Base class for implementing AnnotatedItem. This implementation assumes 
- * the annotationMap is immutable.
- * 
- * @author pmuir
- *
- */
-public abstract class AbstractAnnotatedItem implements AnnotatedItem
-{
-   
-   private Map<Class<? extends Annotation>, Annotation> annotationMap;
-   private Map<Class<? extends Annotation>, Set<Annotation>> metaAnnotations;
-   private Set<Annotation> annotationSet;
-   private Class<?> annotatedClass;
-   
-   public AbstractAnnotatedItem(Class<?> annotatedClass, Map<Class<? extends Annotation>, Annotation> annotationMap)
-   {
-      this.annotatedClass = annotatedClass;
-      if (annotationMap == null)
-      {
-         throw new NullPointerException("annotationMap cannot be null");
-      }
-      this.annotationMap = annotationMap;
-   }
-   
-   @SuppressWarnings("unchecked")
-   public <T extends Annotation> T getAnnotation(Class<T> annotationType)
-   {
-      return (T) annotationMap.get(annotationType);
-   }
-
-   public <T extends Annotation> Set<Annotation> getAnnotations(Class<T> metaAnnotationType)
-   {
-      if (metaAnnotations == null)
-      {
-         metaAnnotations = new HashMap<Class<? extends Annotation>, Set<Annotation>>();
-      }
-      populateMetaAnnotationMap(metaAnnotationType, metaAnnotations, annotationMap);
-      return metaAnnotations.get(metaAnnotationType);
-   }
-   
-   public Set<Annotation> getAnnotations()
-   {
-      if (annotationSet == null)
-      {
-         annotationSet = populateAnnotationSet(new HashSet<Annotation>(), annotationMap);
-      }
-      return annotationSet;
-   }
-
-   public boolean isAnnotationPresent(Class<? extends Annotation> annotatedType)
-   {
-      return annotationMap.containsKey(annotatedType);
-   }
-
-   public Class<?> getAnnotatedClass()
-   {
-      return annotatedClass;
-   }
-   
-   protected static Set<Annotation> populateAnnotationSet(Set<Annotation> annotationSet, Map<Class<? extends Annotation>, Annotation> annotationMap)
-   {
-      for (Entry<Class<? extends Annotation>, Annotation> entry : annotationMap.entrySet())
-      {
-         annotationSet.add(entry.getValue());
-      }
-      return annotationSet;
-   }
-   
-   protected static <T extends Annotation> Map<Class<? extends Annotation>, Set<Annotation>> populateMetaAnnotationMap(Class<T> metaAnnotationType, Map<Class<? extends Annotation>, Set<Annotation>> metaAnnotations, Map<Class<? extends Annotation>, Annotation> annotationMap)
-   {
-      if (!metaAnnotations.containsKey(metaAnnotationType))
-      {
-         Set<Annotation> s = new HashSet<Annotation>();
-         for (Entry<Class<? extends Annotation>, Annotation> entry : annotationMap.entrySet())
-         {
-            if (entry.getValue().annotationType().isAnnotationPresent(metaAnnotationType))
-            {
-               s.add(entry.getValue());
-            }
-         }
-         metaAnnotations.put(metaAnnotationType, s);
-      }
-      return metaAnnotations;
-   }
-   
-   protected Map<Class<? extends Annotation>, Annotation> getAnnotationMap()
-   {
-      return annotationMap;
-   }
-   
-   @Override
-   public String toString()
-   {
-      return annotatedClass + " " + annotationMap.toString();
-   }
-
-}
\ No newline at end of file

Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/AnnotatedItem.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/AnnotatedItem.java	2008-08-10 15:36:43 UTC (rev 94)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/AnnotatedItem.java	2008-08-11 16:32:44 UTC (rev 95)
@@ -1,51 +0,0 @@
-package org.jboss.webbeans.util;
-
-import java.lang.annotation.Annotation;
-import java.util.Set;
-
-/**
- * AnnotatedItem provides a uniform access to the annotations on an annotated
- * item defined either in Java or XML 
- * 
- * @author Pete Muir
- *
- */
-public interface AnnotatedItem
-{
-   
-   /**
-    * Get all annotations on the item
-    * 
-    * An empty set is returned if no annotations are present
-    */
-   public abstract <T extends Annotation> Set<T> getAnnotations();
-   
-   /**
-    * Get all annotations which are annotated with the given meta annotation 
-    * type
-    * 
-    * If no annotations are present which are annotated with the given meta
-    * annotation an empty set is returned
-    */
-   public abstract <T extends Annotation> Set<Annotation> getAnnotations(
-         Class<T> metaAnnotationType);
-   
-   /**
-    * Get an annotation for the annotation type specified.
-    * 
-    * If the annotation isn't present, null is returned
-    */
-   public <T extends Annotation> T getAnnotation(Class<T> annotationType);
-   
-   /**
-    * Return true if the annotation type specified is present
-    */
-   public boolean isAnnotationPresent(Class<? extends Annotation> annotationType);
-   
-   /**
-    * Return the class of the annotated item. If this annotatedItem isn't in use
-    * then this method should return null
-    */
-   public Class<?> getAnnotatedClass();
-   
-}
\ No newline at end of file

Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/ClassAnnotatedItem.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/ClassAnnotatedItem.java	2008-08-10 15:36:43 UTC (rev 94)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/ClassAnnotatedItem.java	2008-08-11 16:32:44 UTC (rev 95)
@@ -1,32 +0,0 @@
-package org.jboss.webbeans.util;
-
-import java.lang.annotation.Annotation;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Implementation of annotatedItem that wraps a simple Java class and reads
- * annotations from there.
- * 
- * @author pmuir
- *
- */
-public class ClassAnnotatedItem extends AbstractAnnotatedItem
-{
-
-   public ClassAnnotatedItem(Class<?> clazz)
-   {
-      super(clazz, buildAnnotationMap(clazz));
-      
-   }
-   
-   protected static Map<Class<? extends Annotation>, Annotation> buildAnnotationMap(Class<?> clazz)
-   {
-      Map<Class<? extends Annotation>, Annotation> annotationMap = new HashMap<Class<? extends Annotation>, Annotation>();
-      for (Annotation annotation : clazz.getAnnotations())
-      {
-         annotationMap.put(annotation.annotationType(), annotation);
-      }
-      return annotationMap;
-   }
-}

Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/MutableAnnotatedItem.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/MutableAnnotatedItem.java	2008-08-10 15:36:43 UTC (rev 94)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/MutableAnnotatedItem.java	2008-08-11 16:32:44 UTC (rev 95)
@@ -1,70 +0,0 @@
-package org.jboss.webbeans.util;
-
-import java.lang.annotation.Annotation;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Support for a mutable annotated item
- *
- */
-public class MutableAnnotatedItem extends AbstractAnnotatedItem
-{
-   
-   private Map<Class<? extends Annotation>, Set<Annotation>> metaAnnotations;
-   private Set<Annotation> annotationSet;
-   
-   public MutableAnnotatedItem(Class<?> annotatedClass, Map<Class<? extends Annotation>, Annotation> annotationMap)
-   {
-      super(annotatedClass, annotationMap);
-   }
-   
-   private void setDirty()
-   {
-      metaAnnotations = null;
-      this.annotationSet = null;
-   }
-   
-   public <T extends Annotation> Set<Annotation> getAnnotations(Class<T> metaAnnotationType)
-   {
-      if (metaAnnotations == null)
-      {
-         metaAnnotations = new HashMap<Class<? extends Annotation>, Set<Annotation>>();
-      }
-      populateMetaAnnotationMap(metaAnnotationType, metaAnnotations, getAnnotationMap());
-      return metaAnnotations.get(metaAnnotationType);
-   }
-   
-   public Set<Annotation> getAnnotations()
-   {
-      if (annotationSet == null)
-      {
-         annotationSet = new HashSet<Annotation>();
-         populateAnnotationSet(annotationSet, getAnnotationMap());
-      }
-      return annotationSet;
-   }
-   
-   /**
-    * Add an annotation to the AnnotatedElement
-    * @param annotation
-    */
-   public void add(Annotation annotation)
-   {
-      setDirty();
-      getAnnotationMap().put(annotation.annotationType(), annotation);
-   }
-   
-   public void addAll(Collection<Annotation> annotations)
-   {
-      for (Annotation annotation : annotations)
-      {
-         this.getAnnotationMap().put(annotation.annotationType(), annotation);
-      }
-      setDirty();
-   }
-   
-}

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ClassAnnotatedItemTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ClassAnnotatedItemTest.java	2008-08-10 15:36:43 UTC (rev 94)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ClassAnnotatedItemTest.java	2008-08-11 16:32:44 UTC (rev 95)
@@ -8,10 +8,11 @@
 import javax.webbeans.Production;
 import javax.webbeans.Stereotype;
 
+import org.jboss.webbeans.introspector.AnnotatedItem;
+import org.jboss.webbeans.introspector.AnnotatedType;
+import org.jboss.webbeans.introspector.SimpleAnnotatedType;
 import org.jboss.webbeans.test.components.Antelope;
 import org.jboss.webbeans.test.components.Order;
-import org.jboss.webbeans.util.AnnotatedItem;
-import org.jboss.webbeans.util.ClassAnnotatedItem;
 import org.junit.Test;
 
 public class ClassAnnotatedItemTest
@@ -20,7 +21,7 @@
    @Test
    public void testDeclaredAnnotations()
    {
-      AnnotatedItem annotatedElement = new ClassAnnotatedItem(Order.class);
+      AnnotatedType annotatedElement = new SimpleAnnotatedType(Order.class);
       assert annotatedElement.getAnnotations().size() == 1;
       assert annotatedElement.getAnnotation(Production.class) != null;
       assert annotatedElement.getAnnotatedClass().equals(Order.class);
@@ -29,7 +30,7 @@
    @Test
    public void testMetaAnnotations()
    {
-      AnnotatedItem annotatedElement = new ClassAnnotatedItem(Order.class);
+      AnnotatedItem annotatedElement = new SimpleAnnotatedType(Order.class);
       Set<Annotation> annotations = annotatedElement.getAnnotations(DeploymentType.class);
       assert annotations.size() == 1;
       Iterator<Annotation> it = annotations.iterator();
@@ -40,10 +41,10 @@
    @Test
    public void testEmpty()
    {
-      AnnotatedItem annotatedElement = new ClassAnnotatedItem(Order.class);
+      AnnotatedItem annotatedElement = new SimpleAnnotatedType(Order.class);
       assert annotatedElement.getAnnotation(Stereotype.class) == null;
       assert annotatedElement.getAnnotations(Stereotype.class).size() == 0;
-      AnnotatedItem classWithNoAnnotations = new ClassAnnotatedItem(Antelope.class);
+      AnnotatedItem classWithNoAnnotations = new SimpleAnnotatedType(Antelope.class);
       assert classWithNoAnnotations.getAnnotations().size() == 0;
    }
    

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ConstructorMetaModelTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ConstructorMetaModelTest.java	2008-08-10 15:36:43 UTC (rev 94)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ConstructorMetaModelTest.java	2008-08-11 16:32:44 UTC (rev 95)
@@ -7,6 +7,8 @@
 
 import org.jboss.webbeans.ContainerImpl;
 import org.jboss.webbeans.injectable.SimpleConstructor;
+import org.jboss.webbeans.introspector.AnnotatedType;
+import org.jboss.webbeans.introspector.SimpleAnnotatedType;
 import org.jboss.webbeans.model.SimpleComponentModel;
 import org.jboss.webbeans.test.annotations.Synchronous;
 import org.jboss.webbeans.test.components.Chicken;
@@ -18,9 +20,6 @@
 import org.jboss.webbeans.test.components.Sheep;
 import org.jboss.webbeans.test.components.Turkey;
 import org.jboss.webbeans.test.mock.MockContainerImpl;
-import org.jboss.webbeans.util.AnnotatedItem;
-import org.jboss.webbeans.util.ClassAnnotatedItem;
-import org.jboss.webbeans.util.MutableAnnotatedItem;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -29,12 +28,12 @@
 
    private ContainerImpl container;
    
-   private AnnotatedItem emptyAnnotatedItem;
+   private AnnotatedType emptyAnnotatedItem;
    
    @Before
    public void before()
    {
-      emptyAnnotatedItem = new MutableAnnotatedItem(null, new HashMap<Class<? extends Annotation>, Annotation>());
+      emptyAnnotatedItem = new SimpleAnnotatedType(null, new HashMap<Class<? extends Annotation>, Annotation>());
       container = new MockContainerImpl(null);
       
    }
@@ -42,7 +41,7 @@
    @Test
    public void testImplicitConstructor()
    {
-      SimpleConstructor<Order> constructor = new SimpleComponentModel<Order>(new ClassAnnotatedItem(Order.class), emptyAnnotatedItem, container).getConstructor();
+      SimpleConstructor<Order> constructor = new SimpleComponentModel<Order>(new SimpleAnnotatedType(Order.class), emptyAnnotatedItem, container).getConstructor();
       assert constructor.getConstructor().getDeclaringClass().equals(Order.class);
       assert constructor.getConstructor().getParameterTypes().length == 0;
       assert constructor.getParameters().size() == 0;
@@ -51,7 +50,7 @@
    @Test
    public void testSingleConstructor()
    {
-      SimpleConstructor<Donkey> constructor = new SimpleComponentModel<Donkey>(new ClassAnnotatedItem(Donkey.class), emptyAnnotatedItem, container).getConstructor();
+      SimpleConstructor<Donkey> constructor = new SimpleComponentModel<Donkey>(new SimpleAnnotatedType(Donkey.class), emptyAnnotatedItem, container).getConstructor();
       assert constructor.getConstructor().getDeclaringClass().equals(Donkey.class);
       assert constructor.getConstructor().getParameterTypes().length == 1;
       assert constructor.getConstructor().getParameterTypes()[0].equals(String.class);
@@ -64,7 +63,7 @@
    @Test
    public void testInitializerAnnotatedConstructor()
    {
-      SimpleConstructor<Sheep> constructor = new SimpleComponentModel<Sheep>(new ClassAnnotatedItem(Sheep.class), emptyAnnotatedItem, container).getConstructor();
+      SimpleConstructor<Sheep> constructor = new SimpleComponentModel<Sheep>(new SimpleAnnotatedType(Sheep.class), emptyAnnotatedItem, container).getConstructor();
       assert constructor.getConstructor().getDeclaringClass().equals(Sheep.class);
       assert constructor.getConstructor().getParameterTypes().length == 2;
       assert constructor.getConstructor().getParameterTypes()[0].equals(String.class);
@@ -81,7 +80,7 @@
    @Test
    public void testBindingTypeAnnotatedConstructor()
    {
-      SimpleConstructor<Duck> constructor = new SimpleComponentModel<Duck>(new ClassAnnotatedItem(Duck.class), emptyAnnotatedItem, container).getConstructor();
+      SimpleConstructor<Duck> constructor = new SimpleComponentModel<Duck>(new SimpleAnnotatedType(Duck.class), emptyAnnotatedItem, container).getConstructor();
       assert constructor.getConstructor().getDeclaringClass().equals(Duck.class);
       assert constructor.getConstructor().getParameterTypes().length == 2;
       assert constructor.getConstructor().getParameterTypes()[0].equals(String.class);
@@ -101,7 +100,7 @@
       boolean exception = false;
       try
       {
-         new SimpleComponentModel<Chicken>(new ClassAnnotatedItem(Chicken.class), emptyAnnotatedItem, container);
+         new SimpleComponentModel<Chicken>(new SimpleAnnotatedType(Chicken.class), emptyAnnotatedItem, container);
       }
       catch (Exception e) 
       {
@@ -117,7 +116,7 @@
       boolean exception = false;
       try
       {
-         new SimpleComponentModel<Turkey>(new ClassAnnotatedItem(Turkey.class), emptyAnnotatedItem, container);
+         new SimpleComponentModel<Turkey>(new SimpleAnnotatedType(Turkey.class), emptyAnnotatedItem, container);
       }
       catch (Exception e) 
       {
@@ -133,7 +132,7 @@
       boolean exception = false;
       try
       {
-         new SimpleComponentModel<Goat>(new ClassAnnotatedItem(Goat.class), emptyAnnotatedItem, container);
+         new SimpleComponentModel<Goat>(new SimpleAnnotatedType(Goat.class), emptyAnnotatedItem, container);
       }
       catch (Exception e) 
       {
@@ -149,7 +148,7 @@
       boolean exception = false;
       try
       {
-         new SimpleComponentModel<Goose>(new ClassAnnotatedItem(Goose.class), emptyAnnotatedItem, container);
+         new SimpleComponentModel<Goose>(new SimpleAnnotatedType(Goose.class), emptyAnnotatedItem, container);
       }
       catch (Exception e) 
       {

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EnterpriseComponentModelTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EnterpriseComponentModelTest.java	2008-08-10 15:36:43 UTC (rev 94)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/EnterpriseComponentModelTest.java	2008-08-11 16:32:44 UTC (rev 95)
@@ -8,6 +8,8 @@
 import javax.webbeans.Dependent;
 
 import org.jboss.webbeans.ContainerImpl;
+import org.jboss.webbeans.introspector.AnnotatedType;
+import org.jboss.webbeans.introspector.SimpleAnnotatedType;
 import org.jboss.webbeans.model.EnterpriseComponentModel;
 import org.jboss.webbeans.test.annotations.Synchronous;
 import org.jboss.webbeans.test.components.Bear;
@@ -21,9 +23,6 @@
 import org.jboss.webbeans.test.components.Puma;
 import org.jboss.webbeans.test.components.Tiger;
 import org.jboss.webbeans.test.mock.MockContainerImpl;
-import org.jboss.webbeans.util.AnnotatedItem;
-import org.jboss.webbeans.util.ClassAnnotatedItem;
-import org.jboss.webbeans.util.MutableAnnotatedItem;
 import org.jboss.webbeans.util.Reflections;
 import org.junit.Before;
 import org.junit.Test;
@@ -33,12 +32,12 @@
    
 private ContainerImpl container;
    
-   private AnnotatedItem emptyAnnotatedItem;
+   private AnnotatedType emptyAnnotatedItem;
    
    @Before
    public void before()
    {
-      emptyAnnotatedItem = new MutableAnnotatedItem(null, new HashMap<Class<? extends Annotation>, Annotation>());
+      emptyAnnotatedItem = new SimpleAnnotatedType(null, new HashMap<Class<? extends Annotation>, Annotation>());
       container = new MockContainerImpl(null);
    }
    
@@ -46,7 +45,7 @@
    @Test
    public void testStateless()
    {
-      EnterpriseComponentModel<Lion> lion = new EnterpriseComponentModel<Lion>(new ClassAnnotatedItem(Lion.class), emptyAnnotatedItem, container);
+      EnterpriseComponentModel<Lion> lion = new EnterpriseComponentModel<Lion>(new SimpleAnnotatedType(Lion.class), emptyAnnotatedItem, container);
       assert lion.getScopeType().annotationType().equals(Dependent.class);
       Reflections.annotationSetMatches(lion.getBindingTypes(), Current.class);
       assert lion.getName().equals("lion");
@@ -57,9 +56,9 @@
    public void testStatelessDefinedInXml()
    {
       Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
-      AnnotatedItem annotatedItem = new MutableAnnotatedItem(Giraffe.class, annotations);
+      AnnotatedType annotatedItem = new SimpleAnnotatedType(Giraffe.class, annotations);
       
-      EnterpriseComponentModel<Giraffe> giraffe = new EnterpriseComponentModel<Giraffe>(new ClassAnnotatedItem(Giraffe.class), annotatedItem, container);
+      EnterpriseComponentModel<Giraffe> giraffe = new EnterpriseComponentModel<Giraffe>(new SimpleAnnotatedType(Giraffe.class), annotatedItem, container);
       assert giraffe.getScopeType().annotationType().equals(Dependent.class);
       Reflections.annotationSetMatches(giraffe.getBindingTypes(), Current.class);
    }
@@ -70,7 +69,7 @@
       boolean exception = false;
       try
       {
-         new EnterpriseComponentModel<Bear>(new ClassAnnotatedItem(Bear.class), emptyAnnotatedItem, container);
+         new EnterpriseComponentModel<Bear>(new SimpleAnnotatedType(Bear.class), emptyAnnotatedItem, container);
       }
       catch (Exception e) 
       {
@@ -100,7 +99,7 @@
    public void testStateful()
    {
 
-      EnterpriseComponentModel<Tiger> tiger = new EnterpriseComponentModel<Tiger>(new ClassAnnotatedItem(Tiger.class), emptyAnnotatedItem, container);
+      EnterpriseComponentModel<Tiger> tiger = new EnterpriseComponentModel<Tiger>(new SimpleAnnotatedType(Tiger.class), emptyAnnotatedItem, container);
       Reflections.annotationSetMatches(tiger.getBindingTypes(), Synchronous.class);
       assert tiger.getRemoveMethod().getMethod().getName().equals("remove");
       assert tiger.getName() == null;
@@ -111,7 +110,7 @@
    public void testMultipleRemoveMethodsWithDestroys()
    {
 
-      EnterpriseComponentModel<Elephant> elephant = new EnterpriseComponentModel<Elephant>(new ClassAnnotatedItem(Elephant.class), emptyAnnotatedItem, container);
+      EnterpriseComponentModel<Elephant> elephant = new EnterpriseComponentModel<Elephant>(new SimpleAnnotatedType(Elephant.class), emptyAnnotatedItem, container);
       assert elephant.getRemoveMethod().getMethod().getName().equals("remove2");
    }
    
@@ -122,7 +121,7 @@
       boolean exception = false;
       try
       {
-         new EnterpriseComponentModel<Puma>(new ClassAnnotatedItem(Puma.class), emptyAnnotatedItem, container);
+         new EnterpriseComponentModel<Puma>(new SimpleAnnotatedType(Puma.class), emptyAnnotatedItem, container);
       }
       catch (Exception e) 
       {
@@ -138,7 +137,7 @@
       boolean exception = false;
       try
       {
-         new EnterpriseComponentModel<Cougar>(new ClassAnnotatedItem(Cougar.class), emptyAnnotatedItem, container);
+         new EnterpriseComponentModel<Cougar>(new SimpleAnnotatedType(Cougar.class), emptyAnnotatedItem, container);
       }
       catch (Exception e) 
       {
@@ -154,7 +153,7 @@
       boolean exception = false;
       try
       {
-         new EnterpriseComponentModel<Cheetah>(new ClassAnnotatedItem(Cheetah.class), emptyAnnotatedItem, container);
+         new EnterpriseComponentModel<Cheetah>(new SimpleAnnotatedType(Cheetah.class), emptyAnnotatedItem, container);
       }
       catch (Exception e) 
       {
@@ -167,7 +166,7 @@
    public void testRemoveMethodWithDefaultBinding()
    {
 
-      EnterpriseComponentModel<Panther> panther = new EnterpriseComponentModel<Panther>(new ClassAnnotatedItem(Panther.class), emptyAnnotatedItem, container);
+      EnterpriseComponentModel<Panther> panther = new EnterpriseComponentModel<Panther>(new SimpleAnnotatedType(Panther.class), emptyAnnotatedItem, container);
       
       assert panther.getRemoveMethod().getMethod().getName().equals("remove");
       assert panther.getRemoveMethod().getParameters().size() == 1;
@@ -180,7 +179,7 @@
    @Test
    public void testMessageDriven()
    {
-      EnterpriseComponentModel<Leopard> leopard = new EnterpriseComponentModel<Leopard>(new ClassAnnotatedItem(Leopard.class), emptyAnnotatedItem, container);
+      EnterpriseComponentModel<Leopard> leopard = new EnterpriseComponentModel<Leopard>(new SimpleAnnotatedType(Leopard.class), emptyAnnotatedItem, container);
       Reflections.annotationSetMatches(leopard.getBindingTypes(), Current.class);
    }
 

Deleted: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/MutableAnnotatedItemTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/MutableAnnotatedItemTest.java	2008-08-10 15:36:43 UTC (rev 94)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/MutableAnnotatedItemTest.java	2008-08-11 16:32:44 UTC (rev 95)
@@ -1,40 +0,0 @@
-package org.jboss.webbeans.test;
-
-import java.lang.annotation.Annotation;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Set;
-
-import javax.webbeans.BindingType;
-import javax.webbeans.Current;
-
-import org.jboss.webbeans.bindings.CurrentBinding;
-import org.jboss.webbeans.util.MutableAnnotatedItem;
-import org.junit.Test;
-
-public class MutableAnnotatedItemTest
-{
-   
-   @Test
-   public void testMutability()
-   {
-      MutableAnnotatedItem annotatedElement = new MutableAnnotatedItem(null, new HashMap<Class<? extends Annotation>, Annotation>());
-      assert annotatedElement.getAnnotations().size() == 0;
-      annotatedElement.add(new CurrentBinding());
-      assert annotatedElement.getAnnotations().size() == 1;
-      assert annotatedElement.getAnnotation(Current.class) != null;
-   }
-   
-   @Test
-   public void testMutableMetaAnnotations()
-   {
-      MutableAnnotatedItem annotatedElement = new MutableAnnotatedItem(null, new HashMap<Class<? extends Annotation>, Annotation>());
-      annotatedElement.add(new CurrentBinding());
-      Set<Annotation> annotations = annotatedElement.getAnnotations(BindingType.class);
-      assert annotations.size() == 1;
-      Iterator<Annotation> it = annotations.iterator();
-      Annotation production = it.next();
-      assert Current.class.equals(production.annotationType());
-   }
-   
-}

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleComponentModelTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleComponentModelTest.java	2008-08-10 15:36:43 UTC (rev 94)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleComponentModelTest.java	2008-08-11 16:32:44 UTC (rev 95)
@@ -22,6 +22,8 @@
 import org.jboss.webbeans.bindings.NamedBinding;
 import org.jboss.webbeans.bindings.RequestScopedBinding;
 import org.jboss.webbeans.bindings.StandardBinding;
+import org.jboss.webbeans.introspector.AnnotatedType;
+import org.jboss.webbeans.introspector.SimpleAnnotatedType;
 import org.jboss.webbeans.model.SimpleComponentModel;
 import org.jboss.webbeans.model.StereotypeModel;
 import org.jboss.webbeans.test.annotations.AnimalStereotype;
@@ -60,9 +62,6 @@
 import org.jboss.webbeans.test.components.broken.ComponentWithTooManyDeploymentTypes;
 import org.jboss.webbeans.test.components.broken.OuterComponent.InnerComponent;
 import org.jboss.webbeans.test.mock.MockContainerImpl;
-import org.jboss.webbeans.util.AnnotatedItem;
-import org.jboss.webbeans.util.ClassAnnotatedItem;
-import org.jboss.webbeans.util.MutableAnnotatedItem;
 import org.jboss.webbeans.util.Reflections;
 import org.junit.Before;
 import org.junit.Test;
@@ -72,12 +71,12 @@
    
    private ContainerImpl container;
    
-   private AnnotatedItem emptyAnnotatedItem;
+   private AnnotatedType emptyAnnotatedItem;
    
    @Before
    public void before()
    {
-      emptyAnnotatedItem = new MutableAnnotatedItem(null, new HashMap<Class<? extends Annotation>, Annotation>());
+      emptyAnnotatedItem = new SimpleAnnotatedType(null, new HashMap<Class<? extends Annotation>, Annotation>());
       
       List<Annotation> enabledDeploymentTypes = new ArrayList<Annotation>();
       enabledDeploymentTypes.add(new StandardBinding());
@@ -90,12 +89,12 @@
    
    private void initStereotypes(ContainerImpl container)
    {
-      container.getStereotypeManager().addStereotype(new StereotypeModel(new ClassAnnotatedItem(AnimalStereotype.class)));
-      container.getStereotypeManager().addStereotype(new StereotypeModel(new ClassAnnotatedItem(HornedMammalStereotype.class)));
-      container.getStereotypeManager().addStereotype(new StereotypeModel(new ClassAnnotatedItem(MammalStereotype.class)));
-      container.getStereotypeManager().addStereotype(new StereotypeModel(new ClassAnnotatedItem(FishStereotype.class)));
-      container.getStereotypeManager().addStereotype(new StereotypeModel(new ClassAnnotatedItem(RiverFishStereotype.class)));
-      container.getStereotypeManager().addStereotype(new StereotypeModel(new ClassAnnotatedItem(RequestScopedAnimalStereotype.class)));
+      container.getStereotypeManager().addStereotype(new StereotypeModel(new SimpleAnnotatedType(AnimalStereotype.class)));
+      container.getStereotypeManager().addStereotype(new StereotypeModel(new SimpleAnnotatedType(HornedMammalStereotype.class)));
+      container.getStereotypeManager().addStereotype(new StereotypeModel(new SimpleAnnotatedType(MammalStereotype.class)));
+      container.getStereotypeManager().addStereotype(new StereotypeModel(new SimpleAnnotatedType(FishStereotype.class)));
+      container.getStereotypeManager().addStereotype(new StereotypeModel(new SimpleAnnotatedType(RiverFishStereotype.class)));
+      container.getStereotypeManager().addStereotype(new StereotypeModel(new SimpleAnnotatedType(RequestScopedAnimalStereotype.class)));
    }
    
    // **** TESTS FOR DEPLOYMENT TYPE **** //
@@ -106,7 +105,7 @@
       boolean exception = false;
       try
       {
-         new SimpleComponentModel<ComponentWithTooManyDeploymentTypes>(new ClassAnnotatedItem(ComponentWithTooManyDeploymentTypes.class), emptyAnnotatedItem, container);
+         new SimpleComponentModel<ComponentWithTooManyDeploymentTypes>(new SimpleAnnotatedType(ComponentWithTooManyDeploymentTypes.class), emptyAnnotatedItem, container);
       }
       catch (Exception e) 
       {
@@ -120,16 +119,16 @@
    {
       Map<Class<? extends Annotation>, Annotation> xmlDefinedDeploymentTypeAnnotations = new HashMap<Class<? extends Annotation>, Annotation>();
       xmlDefinedDeploymentTypeAnnotations.put(AnotherDeploymentType.class, new AnotherDeploymentTypeBinding());
-      AnnotatedItem xmlDefinedDeploymentTypeAnnotatedItem = new MutableAnnotatedItem(ComponentWithTooManyDeploymentTypes.class, xmlDefinedDeploymentTypeAnnotations);
+      AnnotatedType xmlDefinedDeploymentTypeAnnotatedItem = new SimpleAnnotatedType(ComponentWithTooManyDeploymentTypes.class, xmlDefinedDeploymentTypeAnnotations);
       
-      SimpleComponentModel<ComponentWithTooManyDeploymentTypes> component = new SimpleComponentModel<ComponentWithTooManyDeploymentTypes>(new ClassAnnotatedItem(ComponentWithTooManyDeploymentTypes.class), xmlDefinedDeploymentTypeAnnotatedItem, container);
+      SimpleComponentModel<ComponentWithTooManyDeploymentTypes> component = new SimpleComponentModel<ComponentWithTooManyDeploymentTypes>(new SimpleAnnotatedType(ComponentWithTooManyDeploymentTypes.class), xmlDefinedDeploymentTypeAnnotatedItem, container);
       assert component.getDeploymentType().annotationType().equals(AnotherDeploymentType.class);
    }
    
    @Test
    public void testXmlDefaultDeploymentType()
    {
-      AnnotatedItem antelopeAnnotatedItem = new MutableAnnotatedItem(Antelope.class, new HashMap<Class<? extends Annotation>, Annotation>());
+      AnnotatedType antelopeAnnotatedItem = new SimpleAnnotatedType(Antelope.class, new HashMap<Class<? extends Annotation>, Annotation>());
       SimpleComponentModel<Antelope> antelope = new SimpleComponentModel<Antelope>(emptyAnnotatedItem, antelopeAnnotatedItem, container);
       assert antelope.getDeploymentType().annotationType().equals(Production.class);
    }
@@ -137,8 +136,8 @@
    @Test
    public void testXmlIgnoresJavaDeploymentType()
    {
-      AnnotatedItem annotatedItem = new MutableAnnotatedItem(Tuna.class, new HashMap<Class<? extends Annotation>, Annotation>());
-      SimpleComponentModel<Tuna> tuna = new SimpleComponentModel<Tuna>(new ClassAnnotatedItem(Tuna.class), annotatedItem, container);
+      AnnotatedType annotatedItem = new SimpleAnnotatedType(Tuna.class, new HashMap<Class<? extends Annotation>, Annotation>());
+      SimpleComponentModel<Tuna> tuna = new SimpleComponentModel<Tuna>(new SimpleAnnotatedType(Tuna.class), annotatedItem, container);
       assert tuna.getDeploymentType().annotationType().equals(Production.class);
    }
    
@@ -147,9 +146,9 @@
    {
       Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
       annotations.put(HornedMammalStereotype.class, new HornedMamalStereotypeBinding());
-      AnnotatedItem annotatedItem = new MutableAnnotatedItem(Moose.class, annotations);
+      AnnotatedType annotatedItem = new SimpleAnnotatedType(Moose.class, annotations);
       
-      SimpleComponentModel<Moose> moose = new SimpleComponentModel<Moose>(new ClassAnnotatedItem(Moose.class), annotatedItem, container);
+      SimpleComponentModel<Moose> moose = new SimpleComponentModel<Moose>(new SimpleAnnotatedType(Moose.class), annotatedItem, container);
       assert moose.getDeploymentType().annotationType().equals(HornedAnimalDeploymentType.class);
       
    }
@@ -162,9 +161,9 @@
    {
       Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
       annotations.put(Asynchronous.class, new AsynchronousBinding());
-      AnnotatedItem annotatedItem = new MutableAnnotatedItem(Cat.class, annotations);
+      AnnotatedType annotatedItem = new SimpleAnnotatedType(Cat.class, annotations);
       
-      SimpleComponentModel<Cat> cat = new SimpleComponentModel<Cat>(new ClassAnnotatedItem(Cat.class), annotatedItem, container);
+      SimpleComponentModel<Cat> cat = new SimpleComponentModel<Cat>(new SimpleAnnotatedType(Cat.class), annotatedItem, container);
       assert cat.getBindingTypes().size() == 1;
       assert Reflections.annotationSetMatches(cat.getBindingTypes(), Asynchronous.class);
    }
@@ -173,7 +172,7 @@
    @Test
    public void testBindingTypesDeclaredInJava()
    {
-      SimpleComponentModel<Cat> cat = new SimpleComponentModel<Cat>(new ClassAnnotatedItem(Cat.class), emptyAnnotatedItem, container);
+      SimpleComponentModel<Cat> cat = new SimpleComponentModel<Cat>(new SimpleAnnotatedType(Cat.class), emptyAnnotatedItem, container);
       assert cat.getBindingTypes().size() == 1;
       assert Reflections.annotationSetMatches(cat.getBindingTypes(), Synchronous.class);
    }
@@ -184,7 +183,7 @@
    {
       Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
       annotations.put(Asynchronous.class, new AsynchronousBinding());
-      AnnotatedItem annotatedItem = new MutableAnnotatedItem(Antelope.class, annotations);
+      AnnotatedType annotatedItem = new SimpleAnnotatedType(Antelope.class, annotations);
       
       SimpleComponentModel<Antelope> antelope = new SimpleComponentModel<Antelope>(emptyAnnotatedItem, annotatedItem, container);
       assert Reflections.annotationSetMatches(antelope.getBindingTypes(), Asynchronous.class);
@@ -194,7 +193,7 @@
    @Test
    public void testDefaultBindingType()
    {
-      SimpleComponentModel<Order> order = new SimpleComponentModel<Order>(new ClassAnnotatedItem(Order.class), emptyAnnotatedItem, container);
+      SimpleComponentModel<Order> order = new SimpleComponentModel<Order>(new SimpleAnnotatedType(Order.class), emptyAnnotatedItem, container);
       assert order.getBindingTypes().size() == 1;
       order.getBindingTypes().iterator().next().annotationType().equals(Current.class);
    }
@@ -204,7 +203,7 @@
    @Test
    public void testScopeDeclaredInJava()
    {
-      SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new ClassAnnotatedItem(SeaBass.class), emptyAnnotatedItem, container);
+      SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new SimpleAnnotatedType(SeaBass.class), emptyAnnotatedItem, container);
       assert trout.getScopeType().annotationType().equals(RequestScoped.class);
    }
    
@@ -213,9 +212,9 @@
    {
       Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
       annotations.put(RequestScoped.class, new RequestScopedBinding());
-      AnnotatedItem annotatedItem = new MutableAnnotatedItem(Order.class, annotations);
+      AnnotatedType annotatedItem = new SimpleAnnotatedType(Order.class, annotations);
       
-      SimpleComponentModel<Order> order = new SimpleComponentModel<Order>(new ClassAnnotatedItem(Order.class), annotatedItem, container);
+      SimpleComponentModel<Order> order = new SimpleComponentModel<Order>(new SimpleAnnotatedType(Order.class), annotatedItem, container);
       assert order.getScopeType().annotationType().equals(RequestScoped.class);
    }
    
@@ -224,8 +223,8 @@
    {
       Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
       annotations.put(ConversationScoped.class, new ConversationScopedBinding());
-      AnnotatedItem annotatedItem = new MutableAnnotatedItem(SeaBass.class, annotations);
-      SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new ClassAnnotatedItem(SeaBass.class), annotatedItem, container);
+      AnnotatedType annotatedItem = new SimpleAnnotatedType(SeaBass.class, annotations);
+      SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new SimpleAnnotatedType(SeaBass.class), annotatedItem, container);
       assert trout.getScopeType().annotationType().equals(ConversationScoped.class);
    }
    
@@ -233,16 +232,16 @@
    public void testScopeMissingInXml()
    {
       Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
-      AnnotatedItem annotatedItem = new MutableAnnotatedItem(SeaBass.class, annotations);
+      AnnotatedType annotatedItem = new SimpleAnnotatedType(SeaBass.class, annotations);
       
-      SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new ClassAnnotatedItem(SeaBass.class), annotatedItem, container);
+      SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new SimpleAnnotatedType(SeaBass.class), annotatedItem, container);
       assert trout.getScopeType().annotationType().equals(RequestScoped.class);
    }
    
    @Test
    public void testNoScopeSpecified()
    {
-      SimpleComponentModel<Order> order = new SimpleComponentModel<Order>(new ClassAnnotatedItem(Order.class), emptyAnnotatedItem, container);
+      SimpleComponentModel<Order> order = new SimpleComponentModel<Order>(new SimpleAnnotatedType(Order.class), emptyAnnotatedItem, container);
       assert order.getScopeType().annotationType().equals(Dependent.class);
    }
    
@@ -252,7 +251,7 @@
       boolean exception = false;
       try
       {
-         new SimpleComponentModel<ComponentWithTooManyScopeTypes>(new ClassAnnotatedItem(ComponentWithTooManyScopeTypes.class), emptyAnnotatedItem, container);
+         new SimpleComponentModel<ComponentWithTooManyScopeTypes>(new SimpleAnnotatedType(ComponentWithTooManyScopeTypes.class), emptyAnnotatedItem, container);
       }
       catch (Exception e) 
       {
@@ -270,7 +269,7 @@
          Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
          annotations.put(RequestScoped.class, new RequestScopedBinding());
          annotations.put(ConversationScoped.class, new ConversationScopedBinding());
-         AnnotatedItem antelopeAnnotatedItem = new MutableAnnotatedItem(Antelope.class, annotations);
+         AnnotatedType antelopeAnnotatedItem = new SimpleAnnotatedType(Antelope.class, annotations);
          new SimpleComponentModel<Antelope>(emptyAnnotatedItem, antelopeAnnotatedItem, container);
       }
       catch (Exception e) 
@@ -285,8 +284,8 @@
    {
       Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
       annotations.put(FishStereotype.class, new FishStereotypeBinding());
-      AnnotatedItem annotatedItem = new MutableAnnotatedItem(SeaBass.class, annotations);
-      SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new ClassAnnotatedItem(SeaBass.class), annotatedItem, container);
+      AnnotatedType annotatedItem = new SimpleAnnotatedType(SeaBass.class, annotations);
+      SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new SimpleAnnotatedType(SeaBass.class), annotatedItem, container);
       assert trout.getScopeType().annotationType().equals(RequestScoped.class);
    }
    
@@ -296,12 +295,12 @@
       Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
       annotations.put(FishStereotype.class, new FishStereotypeBinding());
       annotations.put(AnimalStereotype.class, new AnimalStereotypeBinding());
-      AnnotatedItem annotatedItem = new MutableAnnotatedItem(Haddock.class, annotations);
+      AnnotatedType annotatedItem = new SimpleAnnotatedType(Haddock.class, annotations);
       
       boolean exception = false;
       try
       {
-         new SimpleComponentModel<Haddock>(new ClassAnnotatedItem(Haddock.class), annotatedItem, container);
+         new SimpleComponentModel<Haddock>(new SimpleAnnotatedType(Haddock.class), annotatedItem, container);
       }
       catch (Exception e) 
       {
@@ -316,9 +315,9 @@
       Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
       annotations.put(FishStereotype.class, new FishStereotypeBinding());
       annotations.put(AnimalStereotype.class, new AnimalStereotypeBinding());
-      AnnotatedItem annotatedItem = new MutableAnnotatedItem(SeaBass.class, annotations);
+      AnnotatedType annotatedItem = new SimpleAnnotatedType(SeaBass.class, annotations);
       
-      SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new ClassAnnotatedItem(SeaBass.class), annotatedItem, container);
+      SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new SimpleAnnotatedType(SeaBass.class), annotatedItem, container);
       assert trout.getScopeType().annotationType().equals(RequestScoped.class);     
    }
    
@@ -328,9 +327,9 @@
       Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
       annotations.put(FishStereotype.class, new FishStereotypeBinding());
       annotations.put(RiverFishStereotype.class, new RiverFishStereotypeBinding());
-      AnnotatedItem annotatedItem = new MutableAnnotatedItem(Haddock.class, annotations);
+      AnnotatedType annotatedItem = new SimpleAnnotatedType(Haddock.class, annotations);
       
-      SimpleComponentModel<Haddock> haddock = new SimpleComponentModel<Haddock>(new ClassAnnotatedItem(Haddock.class), annotatedItem, container);
+      SimpleComponentModel<Haddock> haddock = new SimpleComponentModel<Haddock>(new SimpleAnnotatedType(Haddock.class), annotatedItem, container);
       assert haddock.getScopeType().annotationType().equals(ApplicationScoped.class);
    }
    
@@ -339,7 +338,7 @@
    @Test
    public void testNamed()
    {
-      SimpleComponentModel<Haddock> haddock = new SimpleComponentModel<Haddock>(new ClassAnnotatedItem(Haddock.class), emptyAnnotatedItem, container);
+      SimpleComponentModel<Haddock> haddock = new SimpleComponentModel<Haddock>(new SimpleAnnotatedType(Haddock.class), emptyAnnotatedItem, container);
       assert haddock.getName() != null;
       assert haddock.getName().equals("haddock");
    }
@@ -356,8 +355,8 @@
             return "";
          }
       });
-      AnnotatedItem annotatedItem = new MutableAnnotatedItem(SeaBass.class, annotations);
-      SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new ClassAnnotatedItem(SeaBass.class), annotatedItem, container);
+      AnnotatedType annotatedItem = new SimpleAnnotatedType(SeaBass.class, annotations);
+      SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new SimpleAnnotatedType(SeaBass.class), annotatedItem, container);
       
       assert trout.getName() != null;
       assert trout.getName().equals("seaBass");
@@ -375,8 +374,8 @@
             return "aTrout";
          }
       });
-      AnnotatedItem annotatedItem = new MutableAnnotatedItem(SeaBass.class, annotations);
-      SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new ClassAnnotatedItem(SeaBass.class), annotatedItem, container);
+      AnnotatedType annotatedItem = new SimpleAnnotatedType(SeaBass.class, annotations);
+      SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new SimpleAnnotatedType(SeaBass.class), annotatedItem, container);
       
       assert trout.getName().equals("aTrout");
    }
@@ -384,14 +383,14 @@
    @Test
    public void testNotNamed()
    {
-      SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new ClassAnnotatedItem(SeaBass.class), emptyAnnotatedItem, container);
+      SimpleComponentModel<SeaBass> trout = new SimpleComponentModel<SeaBass>(new SimpleAnnotatedType(SeaBass.class), emptyAnnotatedItem, container);
       assert trout.getName() == null;
    }
    
    @Test
    public void testNonDefaultNamed()
    {
-      SimpleComponentModel<Moose> moose = new SimpleComponentModel<Moose>(new ClassAnnotatedItem(Moose.class), emptyAnnotatedItem, container);
+      SimpleComponentModel<Moose> moose = new SimpleComponentModel<Moose>(new SimpleAnnotatedType(Moose.class), emptyAnnotatedItem, container);
       assert moose.getName().equals("aMoose");
    }
    
@@ -412,9 +411,9 @@
             return "currentSynchronousOrder";
          }
       });
-      AnnotatedItem currentSynchronousOrderAnnotatedItem = new MutableAnnotatedItem(Order.class, orderXmlAnnotations);
+      AnnotatedType currentSynchronousOrderAnnotatedItem = new SimpleAnnotatedType(Order.class, orderXmlAnnotations);
       
-      SimpleComponentModel<Order> order = new SimpleComponentModel<Order>(new ClassAnnotatedItem(Order.class), currentSynchronousOrderAnnotatedItem, container);
+      SimpleComponentModel<Order> order = new SimpleComponentModel<Order>(new SimpleAnnotatedType(Order.class), currentSynchronousOrderAnnotatedItem, container);
       assert Production.class.equals(order.getDeploymentType().annotationType());
       assert "currentSynchronousOrder".equals(order.getName());
       assert order.getBindingTypes().size() == 2;
@@ -425,7 +424,7 @@
    @Test
    public void testSingleStereotype()
    {
-      SimpleComponentModel<Gorilla> gorilla = new SimpleComponentModel<Gorilla>(new ClassAnnotatedItem(Gorilla.class), emptyAnnotatedItem, container);
+      SimpleComponentModel<Gorilla> gorilla = new SimpleComponentModel<Gorilla>(new SimpleAnnotatedType(Gorilla.class), emptyAnnotatedItem, container);
       assert gorilla.getName() == null;
       assert gorilla.getDeploymentType().annotationType().equals(Production.class);
       assert gorilla.getBindingTypes().iterator().next().annotationType().equals(Current.class);
@@ -437,7 +436,7 @@
    {
       try
       {
-         new SimpleComponentModel<Gorilla>(new ClassAnnotatedItem(Gorilla.class), emptyAnnotatedItem, container);
+         new SimpleComponentModel<Gorilla>(new SimpleAnnotatedType(Gorilla.class), emptyAnnotatedItem, container);
       }
       catch (Exception e) 
       {
@@ -452,7 +451,7 @@
       boolean exception = false;
       try
       {
-         new SimpleComponentModel<Chair>(new ClassAnnotatedItem(Chair.class), emptyAnnotatedItem, container);
+         new SimpleComponentModel<Chair>(new SimpleAnnotatedType(Chair.class), emptyAnnotatedItem, container);
       }
       catch (Exception e) 
       {
@@ -467,7 +466,7 @@
    {
       try
       {
-         new SimpleComponentModel<Goldfish>(new ClassAnnotatedItem(Goldfish.class), emptyAnnotatedItem, container);
+         new SimpleComponentModel<Goldfish>(new SimpleAnnotatedType(Goldfish.class), emptyAnnotatedItem, container);
       }
       catch (Exception e) 
       {
@@ -483,7 +482,7 @@
       boolean exception = false;
       try
       {
-         new SimpleComponentModel<Carp>(new ClassAnnotatedItem(Carp.class), emptyAnnotatedItem, container);
+         new SimpleComponentModel<Carp>(new SimpleAnnotatedType(Carp.class), emptyAnnotatedItem, container);
       }
       catch (Exception e) 
       {
@@ -501,7 +500,7 @@
       boolean exception = false;
       try
       {
-         new SimpleComponentModel<Cow>(new ClassAnnotatedItem(Cow.class), emptyAnnotatedItem, container);
+         new SimpleComponentModel<Cow>(new SimpleAnnotatedType(Cow.class), emptyAnnotatedItem, container);
       }
       catch (Exception e) 
       {
@@ -516,7 +515,7 @@
       boolean exception = false;
       try
       {
-         new SimpleComponentModel<Cow>(new ClassAnnotatedItem(InnerComponent.class), emptyAnnotatedItem, container);
+         new SimpleComponentModel<InnerComponent>(new SimpleAnnotatedType(InnerComponent.class), emptyAnnotatedItem, container);
       }
       catch (Exception e) 
       {
@@ -531,7 +530,7 @@
       boolean exception = false;
       try
       {
-         new SimpleComponentModel<Horse>(new ClassAnnotatedItem(Horse.class), emptyAnnotatedItem, container);
+         new SimpleComponentModel<Horse>(new SimpleAnnotatedType(Horse.class), emptyAnnotatedItem, container);
       }
       catch (Exception e) 
       {
@@ -541,10 +540,10 @@
       
       Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
       annotations.put(Dependent.class, new DependentBinding());
-      AnnotatedItem annotatedItem = new MutableAnnotatedItem(Horse.class, annotations);
+      AnnotatedType annotatedItem = new SimpleAnnotatedType(Horse.class, annotations);
       try
       {
-         new SimpleComponentModel<Horse>(new ClassAnnotatedItem(Horse.class), annotatedItem, container);
+         new SimpleComponentModel<Horse>(new SimpleAnnotatedType(Horse.class), annotatedItem, container);
       }
       catch (Exception e) 
       {
@@ -558,7 +557,7 @@
       boolean exception = false;
       try
       {
-         new SimpleComponentModel<Pig>(new ClassAnnotatedItem(Pig.class), emptyAnnotatedItem, container);
+         new SimpleComponentModel<Pig>(new SimpleAnnotatedType(Pig.class), emptyAnnotatedItem, container);
       }
       catch (Exception e) 
       {
@@ -568,10 +567,10 @@
       
       Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
       annotations.put(Dependent.class, new DependentBinding());
-      AnnotatedItem annotatedItem = new MutableAnnotatedItem(Pig.class, annotations);
+      AnnotatedType annotatedItem = new SimpleAnnotatedType(Pig.class, annotations);
       try
       {
-         new SimpleComponentModel<Pig>(new ClassAnnotatedItem(Pig.class), annotatedItem, container);
+         new SimpleComponentModel<Pig>(new SimpleAnnotatedType(Pig.class), annotatedItem, container);
       }
       catch (Exception e) 
       {

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypeMetaModelTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypeMetaModelTest.java	2008-08-10 15:36:43 UTC (rev 94)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypeMetaModelTest.java	2008-08-11 16:32:44 UTC (rev 95)
@@ -7,6 +7,7 @@
 import javax.webbeans.Production;
 import javax.webbeans.RequestScoped;
 
+import org.jboss.webbeans.introspector.SimpleAnnotatedType;
 import org.jboss.webbeans.model.StereotypeModel;
 import org.jboss.webbeans.test.annotations.AnimalOrderStereotype;
 import org.jboss.webbeans.test.annotations.AnimalStereotype;
@@ -17,7 +18,6 @@
 import org.jboss.webbeans.test.annotations.broken.StereotypeWithTooManyScopeTypes;
 import org.jboss.webbeans.test.components.Animal;
 import org.jboss.webbeans.test.components.Order;
-import org.jboss.webbeans.util.ClassAnnotatedItem;
 import org.junit.Test;
 
 public class StereotypeMetaModelTest
@@ -26,7 +26,7 @@
    @Test
    public void testComponentStereotype()
    {
-      StereotypeModel componentStereotype = new StereotypeModel(new ClassAnnotatedItem(Component.class));
+      StereotypeModel componentStereotype = new StereotypeModel(new SimpleAnnotatedType(Component.class));
       
       assert Production.class.equals(componentStereotype.getDefaultDeploymentType().annotationType());
       assert componentStereotype.getDefaultScopeType() == null;
@@ -39,7 +39,7 @@
    @Test
    public void testModelStereotype()
    {
-      StereotypeModel modelStereotype = new StereotypeModel(new ClassAnnotatedItem(Model.class));
+      StereotypeModel modelStereotype = new StereotypeModel(new SimpleAnnotatedType(Model.class));
       assert Production.class.equals(modelStereotype.getDefaultDeploymentType().annotationType());
       assert RequestScoped.class.equals(modelStereotype.getDefaultScopeType().annotationType());
       assert modelStereotype.isComponentNameDefaulted();
@@ -51,7 +51,7 @@
    @Test
    public void testAnimalStereotype()
    {
-      StereotypeModel animalStereotype = new StereotypeModel(new ClassAnnotatedItem(AnimalStereotype.class));
+      StereotypeModel animalStereotype = new StereotypeModel(new SimpleAnnotatedType(AnimalStereotype.class));
       assert animalStereotype.getDefaultScopeType().annotationType().equals(RequestScoped.class);
       assert animalStereotype.getInterceptorBindings().size() == 0;
       assert animalStereotype.getRequiredTypes().size() == 1;
@@ -64,7 +64,7 @@
    @Test
    public void testAnimalOrderStereotype()
    {
-      StereotypeModel animalStereotype = new StereotypeModel(new ClassAnnotatedItem(AnimalOrderStereotype.class));
+      StereotypeModel animalStereotype = new StereotypeModel(new SimpleAnnotatedType(AnimalOrderStereotype.class));
       assert animalStereotype.getDefaultScopeType() == null;
       assert animalStereotype.getInterceptorBindings().size() == 0;
       assert animalStereotype.getRequiredTypes().size() == 2;
@@ -78,7 +78,7 @@
    @Test
    public void testRequestScopedAnimalStereotype()
    {
-      StereotypeModel animalStereotype = new StereotypeModel(new ClassAnnotatedItem(RequestScopedAnimalStereotype.class));
+      StereotypeModel animalStereotype = new StereotypeModel(new SimpleAnnotatedType(RequestScopedAnimalStereotype.class));
       assert animalStereotype.getDefaultScopeType() == null;
       assert animalStereotype.getInterceptorBindings().size() == 0;
       assert animalStereotype.getRequiredTypes().size() == 1;
@@ -95,7 +95,7 @@
       boolean exception = false;
       try
       {
-         new StereotypeModel(new ClassAnnotatedItem(StereotypeWithTooManyScopeTypes.class));
+         new StereotypeModel(new SimpleAnnotatedType(StereotypeWithTooManyScopeTypes.class));
       }
       catch (Exception e) 
       {
@@ -110,7 +110,7 @@
       boolean exception = false;
       try
       {
-         new StereotypeModel(new ClassAnnotatedItem(StereotypeWithTooManyDeploymentTypes.class));
+         new StereotypeModel(new SimpleAnnotatedType(StereotypeWithTooManyDeploymentTypes.class));
       }
       catch (Exception e) 
       {
@@ -125,7 +125,7 @@
       boolean exception = false;
       try
       {
-         new StereotypeModel(new ClassAnnotatedItem(StereotypeWithNonEmptyNamed.class));
+         new StereotypeModel(new SimpleAnnotatedType(StereotypeWithNonEmptyNamed.class));
       }
       catch (Exception e) 
       {
@@ -140,7 +140,7 @@
       boolean exception = false;
       try
       {
-         new StereotypeModel(new ClassAnnotatedItem(StereotypeWithBindingTypes.class));
+         new StereotypeModel(new SimpleAnnotatedType(StereotypeWithBindingTypes.class));
       }
       catch (Exception e) 
       {




More information about the weld-commits mailing list