[webbeans-commits] Webbeans SVN: r244 - in ri/trunk/webbeans-ri/src: main/java/org/jboss/webbeans/model/bean and 3 other directories.
webbeans-commits at lists.jboss.org
webbeans-commits at lists.jboss.org
Wed Nov 5 08:02:04 EST 2008
Author: pete.muir at jboss.org
Date: 2008-11-05 08:02:04 -0500 (Wed, 05 Nov 2008)
New Revision: 244
Added:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AbstractAnnotatedMember.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AbstractAnnotatedType.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedClass.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedItem.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/SimpleAnnotatedClass.java
Removed:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedItem.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/SimpleAnnotatedType.java
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedAnnotation.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedAnnotation.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedConstructor.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedField.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/model/bean/AbstractBeanModel.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/AbstractClassBeanModel.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/AbstractEnterpriseBeanModel.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/EnterpriseBeanModel.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/EventBeanModel.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/ProducerMethodBeanModel.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/SimpleBeanModel.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Reflections.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/BindingTypeTest.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/DeferredEventNotificationTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeploymentTypeTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NameTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NormalContextTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ObserverTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerMethodBeanModelTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ScopeTypeTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleBeanModelTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypesTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/TypeTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/util/Util.java
Log:
Refactor to allow isStatic/isFinal etc. on annotateditem
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AbstractAnnotatedMember.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AbstractAnnotatedMember.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AbstractAnnotatedMember.java 2008-11-05 13:02:04 UTC (rev 244)
@@ -0,0 +1,27 @@
+package org.jboss.webbeans.introspector;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Member;
+import java.util.Map;
+
+import org.jboss.webbeans.util.Reflections;
+
+public abstract class AbstractAnnotatedMember<T, S extends Member> extends AbstractAnnotatedItem<T, S>
+{
+
+ public AbstractAnnotatedMember(Map<Class<? extends Annotation>, Annotation> annotationMap)
+ {
+ super(annotationMap);
+ }
+
+ public boolean isStatic()
+ {
+ return Reflections.isStatic(getDelegate());
+ }
+
+ public boolean isFinal()
+ {
+ return Reflections.isFinal(getDelegate());
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AbstractAnnotatedMember.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AbstractAnnotatedType.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AbstractAnnotatedType.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AbstractAnnotatedType.java 2008-11-05 13:02:04 UTC (rev 244)
@@ -0,0 +1,26 @@
+package org.jboss.webbeans.introspector;
+
+import java.lang.annotation.Annotation;
+import java.util.Map;
+
+import org.jboss.webbeans.util.Reflections;
+
+public abstract class AbstractAnnotatedType<T> extends AbstractAnnotatedItem<T, Class<T>>
+{
+
+ public AbstractAnnotatedType(Map<Class<? extends Annotation>, Annotation> annotationMap)
+ {
+ super(annotationMap);
+ }
+
+ public boolean isStatic()
+ {
+ return Reflections.isStatic(getDelegate());
+ }
+
+ public boolean isFinal()
+ {
+ return Reflections.isFinal(getDelegate());
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AbstractAnnotatedType.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedAnnotation.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedAnnotation.java 2008-11-05 12:27:30 UTC (rev 243)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedAnnotation.java 2008-11-05 13:02:04 UTC (rev 244)
@@ -3,7 +3,7 @@
import java.lang.annotation.Annotation;
import java.util.Set;
-public interface AnnotatedAnnotation<T extends Annotation> extends AnnotatedItem<T, Class<T>>
+public interface AnnotatedAnnotation<T extends Annotation> extends AnnotatedType<T>
{
/**
Copied: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedClass.java (from rev 243, ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedType.java)
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedClass.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedClass.java 2008-11-05 13:02:04 UTC (rev 244)
@@ -0,0 +1,58 @@
+package org.jboss.webbeans.introspector;
+
+import java.lang.annotation.Annotation;
+import java.util.Set;
+
+
+/**
+ * AnnotatedType provides a uniform access to the annotations on an annotated
+ * class defined either in Java or XML
+ *
+ * @author Pete Muir
+ *
+ */
+public interface AnnotatedClass<T> extends AnnotatedType<T>
+{
+
+ /**
+ * Return the class of the annotated item. If this annotatedItem isn't in use
+ * then this method should return null
+ */
+ public Class<? extends T> getAnnotatedClass();
+
+ /**
+ * Get all fields on the type
+ * @return
+ */
+ public Set<AnnotatedField<Object>> getFields();
+
+ /**
+ * Get all annotations which are annotated with the given annotation
+ * type
+ *
+ * If no annotations are present which are annotated with the given
+ * annotation an empty set is returned
+ */
+ public Set<AnnotatedField<Object>> getAnnotatedFields(Class<? extends Annotation> annotationType);
+
+ /**
+ * Get all fields 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 Set<AnnotatedField<Object>> getMetaAnnotatedFields(
+ Class<? extends Annotation> metaAnnotationType);
+
+ /**
+ * Get all fields 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 Set<AnnotatedMethod<Object>> getAnnotatedMethods(
+ Class<? extends Annotation> annotationType);
+
+}
\ No newline at end of file
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedClass.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: 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 2008-11-05 12:27:30 UTC (rev 243)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedItem.java 2008-11-05 13:02:04 UTC (rev 244)
@@ -1,62 +0,0 @@
-package org.jboss.webbeans.introspector;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-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<T, S>
-{
-
- /**
- * Get all annotations on the item
- *
- * An empty set is returned if no annotations are present
- */
- public <A extends Annotation> Set<A> 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 Set<Annotation> getAnnotations(
- Class<? extends Annotation> metaAnnotationType);
-
- public Annotation[] getAnnotationsAsArray(
- Class<? extends Annotation> metaAnnotationType);
-
- /**
- * Get an annotation for the annotation type specified.
- *
- * If the annotation isn't present, null is returned
- */
- public <A extends Annotation> A getAnnotation(
- Class<? extends A> annotationType);
-
- /**
- * Return true if the annotation type specified is present
- */
- public boolean isAnnotationPresent(
- Class<? extends Annotation> annotationType);
-
- public S getDelegate();
-
- public Class<? extends T> getType();
-
- public boolean isAssignableFrom(AnnotatedItem<?, ?> that);
-
- public boolean isAssignableFrom(Set<Class<?>> types);
-
- public Type[] getActualTypeArguments();
-
-}
\ No newline at end of file
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-11-05 13:02:04 UTC (rev 244)
@@ -0,0 +1,66 @@
+package org.jboss.webbeans.introspector;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+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<T, S>
+{
+
+ /**
+ * Get all annotations on the item
+ *
+ * An empty set is returned if no annotations are present
+ */
+ public <A extends Annotation> Set<A> 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 Set<Annotation> getAnnotations(
+ Class<? extends Annotation> metaAnnotationType);
+
+ public Annotation[] getAnnotationsAsArray(
+ Class<? extends Annotation> metaAnnotationType);
+
+ /**
+ * Get an annotation for the annotation type specified.
+ *
+ * If the annotation isn't present, null is returned
+ */
+ public <A extends Annotation> A getAnnotation(
+ Class<? extends A> annotationType);
+
+ /**
+ * Return true if the annotation type specified is present
+ */
+ public boolean isAnnotationPresent(
+ Class<? extends Annotation> annotationType);
+
+ public S getDelegate();
+
+ public Class<? extends T> getType();
+
+ public boolean isAssignableFrom(AnnotatedItem<?, ?> that);
+
+ public boolean isAssignableFrom(Set<Class<?>> types);
+
+ public Type[] getActualTypeArguments();
+
+ public boolean isStatic();
+
+ public boolean isFinal();
+
+}
\ No newline at end of file
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedType.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedType.java 2008-11-05 12:27:30 UTC (rev 243)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedType.java 2008-11-05 13:02:04 UTC (rev 244)
@@ -1,58 +0,0 @@
-package org.jboss.webbeans.introspector;
-
-import java.lang.annotation.Annotation;
-import java.util.Set;
-
-
-/**
- * AnnotatedType provides a uniform access to the annotations on an annotated
- * class defined either in Java or XML
- *
- * @author Pete Muir
- *
- */
-public interface AnnotatedType<T> extends AnnotatedItem<T, Class<T>>
-{
-
- /**
- * Return the class of the annotated item. If this annotatedItem isn't in use
- * then this method should return null
- */
- public Class<? extends T> getAnnotatedClass();
-
- /**
- * Get all fields on the type
- * @return
- */
- public Set<AnnotatedField<Object>> getFields();
-
- /**
- * Get all annotations which are annotated with the given annotation
- * type
- *
- * If no annotations are present which are annotated with the given
- * annotation an empty set is returned
- */
- public Set<AnnotatedField<Object>> getAnnotatedFields(Class<? extends Annotation> annotationType);
-
- /**
- * Get all fields 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 Set<AnnotatedField<Object>> getMetaAnnotatedFields(
- Class<? extends Annotation> metaAnnotationType);
-
- /**
- * Get all fields 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 Set<AnnotatedMethod<Object>> getAnnotatedMethods(
- Class<? extends Annotation> annotationType);
-
-}
\ No newline at end of file
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/AnnotatedType.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-11-05 13:02:04 UTC (rev 244)
@@ -0,0 +1,6 @@
+package org.jboss.webbeans.introspector;
+
+public interface AnnotatedType<T> extends AnnotatedItem<T, Class<T>>
+{
+
+}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedAnnotation.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedAnnotation.java 2008-11-05 12:27:30 UTC (rev 243)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedAnnotation.java 2008-11-05 13:02:04 UTC (rev 244)
@@ -8,7 +8,7 @@
import java.util.Map;
import java.util.Set;
-public class SimpleAnnotatedAnnotation<T extends Annotation> extends AbstractAnnotatedItem<T, Class<T>> implements AnnotatedAnnotation<T>
+public class SimpleAnnotatedAnnotation<T extends Annotation> extends AbstractAnnotatedType<T> implements AnnotatedAnnotation<T>
{
private Map<Class<? extends Annotation>, Set<AnnotatedMethod<?>>> annotatedMembers;
Copied: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedClass.java (from rev 243, ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedType.java)
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedClass.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedClass.java 2008-11-05 13:02:04 UTC (rev 244)
@@ -0,0 +1,201 @@
+package org.jboss.webbeans.introspector;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Base class for implementing AnnotatedItem. This implementation assumes
+ * the annotationMap is immutable.
+ *
+ * @author pmuir
+ *
+ */
+public class SimpleAnnotatedClass<T> extends AbstractAnnotatedType<T> implements AnnotatedClass<T>
+{
+
+ private Class<T> clazz;
+ private Type[] actualTypeArguments;
+ private Set<AnnotatedField<Object>> fields;
+ private Map<Class<? extends Annotation>, Set<AnnotatedField<Object>>> annotatedFields;
+ private Map<Class<? extends Annotation>, Set<AnnotatedField<Object>>> metaAnnotatedFields;
+
+ private Set<AnnotatedMethod<Object>> methods;
+ private Map<Class<? extends Annotation>, Set<AnnotatedMethod<Object>>> annotatedMethods;
+
+ public SimpleAnnotatedClass(Class<T> annotatedClass, Map<Class<? extends Annotation>, Annotation> annotationMap)
+ {
+ super(annotationMap);
+ this.clazz = annotatedClass;
+ if (this.clazz.getGenericSuperclass() instanceof ParameterizedType)
+ {
+ ParameterizedType type = (ParameterizedType) this.clazz.getGenericSuperclass();
+ actualTypeArguments = type.getActualTypeArguments();
+ }
+ else
+ {
+ actualTypeArguments = new Type[0];
+ }
+ }
+
+ public SimpleAnnotatedClass(Class<T> annotatedClass)
+ {
+ this(annotatedClass, buildAnnotationMap(annotatedClass));
+ }
+
+ public Class<? extends T> getAnnotatedClass()
+ {
+ return clazz;
+ }
+
+ public Class<T> getDelegate()
+ {
+ return clazz;
+ }
+
+ public Set<AnnotatedField<Object>> getFields()
+ {
+ if (fields == null)
+ {
+ initFields();
+ }
+ return fields;
+ }
+
+ private void initFields()
+ {
+ this.fields = new HashSet<AnnotatedField<Object>>();
+ for(Field field : clazz.getFields())
+ {
+ fields.add(new SimpleAnnotatedField<Object>(field));
+ }
+ }
+
+ public Set<AnnotatedField<Object>> getMetaAnnotatedFields(
+ Class<? extends Annotation> metaAnnotationType)
+ {
+ if (metaAnnotatedFields == null)
+ {
+ metaAnnotatedFields = new HashMap<Class<? extends Annotation>, Set<AnnotatedField<Object>>>();
+ }
+ if (annotatedFields == null)
+ {
+ initAnnotatedFields();
+ }
+ populateMetaAnnotatedFieldMap(metaAnnotationType, annotatedFields, metaAnnotatedFields);
+ return metaAnnotatedFields.get(metaAnnotationType);
+ }
+
+ protected static <T extends Annotation> Map<Class<? extends Annotation>, Set<AnnotatedField<Object>>> populateMetaAnnotatedFieldMap(
+ Class<T> metaAnnotationType,
+ Map<Class<? extends Annotation>, Set<AnnotatedField<Object>>> annotatedFields,
+ Map<Class<? extends Annotation>, Set<AnnotatedField<Object>>> metaAnnotatedFields)
+ {
+ if (!metaAnnotatedFields.containsKey(metaAnnotationType))
+ {
+ Set<AnnotatedField<Object>> s = new HashSet<AnnotatedField<Object>>();
+ for (Class<? extends Annotation> annotationType: annotatedFields.keySet())
+ {
+ if (annotationType.isAnnotationPresent(metaAnnotationType))
+ {
+ s.addAll(annotatedFields.get(annotationType));
+ }
+ }
+ metaAnnotatedFields.put(metaAnnotationType, s);
+ }
+ return metaAnnotatedFields;
+ }
+
+ public Set<AnnotatedField<Object>> getAnnotatedFields(
+ Class<? extends Annotation> annotationType)
+ {
+ if (annotatedFields == null)
+ {
+ initAnnotatedFields();
+ }
+ return annotatedFields.get(annotationType);
+ }
+
+ private void initAnnotatedFields()
+ {
+ if (fields == null)
+ {
+ initFields();
+ }
+ annotatedFields = new HashMap<Class<? extends Annotation>, Set<AnnotatedField<Object>>>();
+ for (AnnotatedField<Object> field : fields)
+ {
+ for (Annotation annotation : field.getAnnotations())
+ {
+ if (!annotatedFields.containsKey(annotation))
+ {
+ annotatedFields.put(annotation.annotationType(), new HashSet<AnnotatedField<Object>>());
+ }
+ annotatedFields.get(annotation.annotationType()).add(field);
+ }
+ }
+ }
+
+ public Class<T> getType()
+ {
+ return clazz;
+ }
+
+ public Type[] getActualTypeArguments()
+ {
+ return actualTypeArguments;
+ }
+
+ private void initMethods()
+ {
+ this.methods = new HashSet<AnnotatedMethod<Object>>();
+ for (Method member : clazz.getDeclaredMethods())
+ {
+ methods.add(new SimpleAnnotatedMethod<Object>(member));
+ }
+ }
+
+ public Set<AnnotatedMethod<Object>> getAnnotatedMethods(Class<? extends Annotation> annotationType)
+ {
+ if (annotatedMethods == null)
+ {
+ initAnnotatedMethods();
+ }
+
+ if (!annotatedMethods.containsKey(annotationType))
+ {
+ return new HashSet<AnnotatedMethod<Object>>();
+ }
+ else
+ {
+ return annotatedMethods.get(annotationType);
+ }
+ }
+
+ private void initAnnotatedMethods()
+ {
+ if (methods == null)
+ {
+ initMethods();
+ }
+ annotatedMethods = new HashMap<Class<? extends Annotation>, Set<AnnotatedMethod<Object>>>();
+ for (AnnotatedMethod<Object> member : methods)
+ {
+ for (Annotation annotation : member.getAnnotations())
+ {
+ if (!annotatedMethods.containsKey(annotation))
+ {
+ annotatedMethods.put(annotation.annotationType(), new HashSet<AnnotatedMethod<Object>>());
+ }
+ annotatedMethods.get(annotation.annotationType()).add(member);
+ }
+ }
+ }
+
+}
\ No newline at end of file
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedClass.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedConstructor.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedConstructor.java 2008-11-05 12:27:30 UTC (rev 243)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedConstructor.java 2008-11-05 13:02:04 UTC (rev 244)
@@ -3,7 +3,7 @@
import java.lang.reflect.Constructor;
import java.lang.reflect.Type;
-public class SimpleAnnotatedConstructor<T> extends AbstractAnnotatedItem<T, Constructor<T>> implements AnnotatedConstructor<T>
+public class SimpleAnnotatedConstructor<T> extends AbstractAnnotatedMember<T, Constructor<T>> implements AnnotatedConstructor<T>
{
private static final Type[] actualTypeArguments = new Type[0];
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedField.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedField.java 2008-11-05 12:27:30 UTC (rev 243)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedField.java 2008-11-05 13:02:04 UTC (rev 244)
@@ -4,7 +4,7 @@
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
-public class SimpleAnnotatedField<T> extends AbstractAnnotatedItem<T, Field> implements AnnotatedField<T>
+public class SimpleAnnotatedField<T> extends AbstractAnnotatedMember<T, Field> implements AnnotatedField<T>
{
private Type[] actualTypeArguments = new Type[0];
Modified: 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 2008-11-05 12:27:30 UTC (rev 243)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedItem.java 2008-11-05 13:02:04 UTC (rev 244)
@@ -85,4 +85,14 @@
return actualAnnotations;
}
+ public boolean isStatic()
+ {
+ return false;
+ }
+
+ public boolean isFinal()
+ {
+ return false;
+ }
+
}
Modified: 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 2008-11-05 12:27:30 UTC (rev 243)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedMethod.java 2008-11-05 13:02:04 UTC (rev 244)
@@ -3,7 +3,7 @@
import java.lang.reflect.Method;
import java.lang.reflect.Type;
-public class SimpleAnnotatedMethod<T> extends AbstractAnnotatedItem<T, Method> implements AnnotatedMethod<T>
+public class SimpleAnnotatedMethod<T> extends AbstractAnnotatedMember<T, Method> implements AnnotatedMethod<T>
{
private static final Type[] actualTypeArgements = new Type[0];
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedType.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedType.java 2008-11-05 12:27:30 UTC (rev 243)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/SimpleAnnotatedType.java 2008-11-05 13:02:04 UTC (rev 244)
@@ -1,201 +0,0 @@
-package org.jboss.webbeans.introspector;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Base class for implementing AnnotatedItem. This implementation assumes
- * the annotationMap is immutable.
- *
- * @author pmuir
- *
- */
-public class SimpleAnnotatedType<T> extends AbstractAnnotatedItem<T, Class<T>> implements AnnotatedType<T>
-{
-
- private Class<T> clazz;
- private Type[] actualTypeArguments;
- private Set<AnnotatedField<Object>> fields;
- private Map<Class<? extends Annotation>, Set<AnnotatedField<Object>>> annotatedFields;
- private Map<Class<? extends Annotation>, Set<AnnotatedField<Object>>> metaAnnotatedFields;
-
- private Set<AnnotatedMethod<Object>> methods;
- private Map<Class<? extends Annotation>, Set<AnnotatedMethod<Object>>> annotatedMethods;
-
- public SimpleAnnotatedType(Class<T> annotatedClass, Map<Class<? extends Annotation>, Annotation> annotationMap)
- {
- super(annotationMap);
- this.clazz = annotatedClass;
- if (this.clazz.getGenericSuperclass() instanceof ParameterizedType)
- {
- ParameterizedType type = (ParameterizedType) this.clazz.getGenericSuperclass();
- actualTypeArguments = type.getActualTypeArguments();
- }
- else
- {
- actualTypeArguments = new Type[0];
- }
- }
-
- public SimpleAnnotatedType(Class<T> annotatedClass)
- {
- this(annotatedClass, buildAnnotationMap(annotatedClass));
- }
-
- public Class<? extends T> getAnnotatedClass()
- {
- return clazz;
- }
-
- public Class<T> getDelegate()
- {
- return clazz;
- }
-
- public Set<AnnotatedField<Object>> getFields()
- {
- if (fields == null)
- {
- initFields();
- }
- return fields;
- }
-
- private void initFields()
- {
- this.fields = new HashSet<AnnotatedField<Object>>();
- for(Field field : clazz.getFields())
- {
- fields.add(new SimpleAnnotatedField<Object>(field));
- }
- }
-
- public Set<AnnotatedField<Object>> getMetaAnnotatedFields(
- Class<? extends Annotation> metaAnnotationType)
- {
- if (metaAnnotatedFields == null)
- {
- metaAnnotatedFields = new HashMap<Class<? extends Annotation>, Set<AnnotatedField<Object>>>();
- }
- if (annotatedFields == null)
- {
- initAnnotatedFields();
- }
- populateMetaAnnotatedFieldMap(metaAnnotationType, annotatedFields, metaAnnotatedFields);
- return metaAnnotatedFields.get(metaAnnotationType);
- }
-
- protected static <T extends Annotation> Map<Class<? extends Annotation>, Set<AnnotatedField<Object>>> populateMetaAnnotatedFieldMap(
- Class<T> metaAnnotationType,
- Map<Class<? extends Annotation>, Set<AnnotatedField<Object>>> annotatedFields,
- Map<Class<? extends Annotation>, Set<AnnotatedField<Object>>> metaAnnotatedFields)
- {
- if (!metaAnnotatedFields.containsKey(metaAnnotationType))
- {
- Set<AnnotatedField<Object>> s = new HashSet<AnnotatedField<Object>>();
- for (Class<? extends Annotation> annotationType: annotatedFields.keySet())
- {
- if (annotationType.isAnnotationPresent(metaAnnotationType))
- {
- s.addAll(annotatedFields.get(annotationType));
- }
- }
- metaAnnotatedFields.put(metaAnnotationType, s);
- }
- return metaAnnotatedFields;
- }
-
- public Set<AnnotatedField<Object>> getAnnotatedFields(
- Class<? extends Annotation> annotationType)
- {
- if (annotatedFields == null)
- {
- initAnnotatedFields();
- }
- return annotatedFields.get(annotationType);
- }
-
- private void initAnnotatedFields()
- {
- if (fields == null)
- {
- initFields();
- }
- annotatedFields = new HashMap<Class<? extends Annotation>, Set<AnnotatedField<Object>>>();
- for (AnnotatedField<Object> field : fields)
- {
- for (Annotation annotation : field.getAnnotations())
- {
- if (!annotatedFields.containsKey(annotation))
- {
- annotatedFields.put(annotation.annotationType(), new HashSet<AnnotatedField<Object>>());
- }
- annotatedFields.get(annotation.annotationType()).add(field);
- }
- }
- }
-
- public Class<T> getType()
- {
- return clazz;
- }
-
- public Type[] getActualTypeArguments()
- {
- return actualTypeArguments;
- }
-
- private void initMethods()
- {
- this.methods = new HashSet<AnnotatedMethod<Object>>();
- for (Method member : clazz.getDeclaredMethods())
- {
- methods.add(new SimpleAnnotatedMethod<Object>(member));
- }
- }
-
- public Set<AnnotatedMethod<Object>> getAnnotatedMethods(Class<? extends Annotation> annotationType)
- {
- if (annotatedMethods == null)
- {
- initAnnotatedMethods();
- }
-
- if (!annotatedMethods.containsKey(annotationType))
- {
- return new HashSet<AnnotatedMethod<Object>>();
- }
- else
- {
- return annotatedMethods.get(annotationType);
- }
- }
-
- private void initAnnotatedMethods()
- {
- if (methods == null)
- {
- initMethods();
- }
- annotatedMethods = new HashMap<Class<? extends Annotation>, Set<AnnotatedMethod<Object>>>();
- for (AnnotatedMethod<Object> member : methods)
- {
- for (Annotation annotation : member.getAnnotations())
- {
- if (!annotatedMethods.containsKey(annotation))
- {
- annotatedMethods.put(annotation.annotationType(), new HashSet<AnnotatedMethod<Object>>());
- }
- annotatedMethods.get(annotation.annotationType()).add(member);
- }
- }
- }
-
-}
\ No newline at end of file
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/AbstractBeanModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/AbstractBeanModel.java 2008-11-05 12:27:30 UTC (rev 243)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/AbstractBeanModel.java 2008-11-05 13:02:04 UTC (rev 244)
@@ -24,7 +24,7 @@
import org.jboss.webbeans.injectable.InjectableMethod;
import org.jboss.webbeans.injectable.InjectableParameter;
import org.jboss.webbeans.introspector.AnnotatedItem;
-import org.jboss.webbeans.introspector.SimpleAnnotatedType;
+import org.jboss.webbeans.introspector.SimpleAnnotatedClass;
import org.jboss.webbeans.model.MergedStereotypesModel;
import org.jboss.webbeans.util.LoggerUtil;
import org.jboss.webbeans.util.Reflections;
@@ -67,8 +67,8 @@
throw new UnsupportedOperationException();
}
- protected static <T> SimpleAnnotatedType getEmptyAnnotatedType(Class<T> type) {
- return new SimpleAnnotatedType<T>(type, new HashMap<Class<? extends Annotation>, Annotation>());
+ protected static <T> SimpleAnnotatedClass getEmptyAnnotatedType(Class<T> type) {
+ return new SimpleAnnotatedClass<T>(type, new HashMap<Class<? extends Annotation>, Annotation>());
}
protected void initInjectionPoints()
@@ -294,6 +294,7 @@
return;
}
+ // TODO This isn't the right way to check if XML isn't in use
if (getXmlAnnotatedItem().getDelegate() != null)
{
this.deploymentType = Production.class;
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/AbstractClassBeanModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/AbstractClassBeanModel.java 2008-11-05 12:27:30 UTC (rev 243)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/AbstractClassBeanModel.java 2008-11-05 13:02:04 UTC (rev 244)
@@ -13,9 +13,9 @@
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.injectable.InjectableField;
import org.jboss.webbeans.injectable.InjectableMethod;
+import org.jboss.webbeans.introspector.AnnotatedClass;
import org.jboss.webbeans.introspector.AnnotatedField;
import org.jboss.webbeans.introspector.AnnotatedMethod;
-import org.jboss.webbeans.introspector.AnnotatedType;
import org.jboss.webbeans.util.LoggerUtil;
import org.jboss.webbeans.util.Reflections;
import org.jboss.webbeans.util.Strings;
@@ -33,8 +33,8 @@
private static Logger log = LoggerUtil.getLogger(LOGGER_NAME);
- private AnnotatedType<T> annotatedItem;
- private AnnotatedType<T> xmlAnnotatedItem;
+ private AnnotatedClass<T> annotatedItem;
+ private AnnotatedClass<T> xmlAnnotatedItem;
private Set<InjectableField<?>> injectableFields;
private Set<InjectableMethod<Object>> initializerMethods;
@@ -44,7 +44,7 @@
* @param xmlAnnotatedItem Annotations read from XML
* @param manager
*/
- public AbstractClassBeanModel(AnnotatedType<T> annotatedItem, AnnotatedType<T> xmlAnnotatedItem)
+ public AbstractClassBeanModel(AnnotatedClass<T> annotatedItem, AnnotatedClass<T> xmlAnnotatedItem)
{
if (annotatedItem == null)
{
@@ -72,19 +72,20 @@
}
@Override
- protected AnnotatedType<T> getAnnotatedItem()
+ protected AnnotatedClass<T> getAnnotatedItem()
{
return annotatedItem;
}
@Override
- protected AnnotatedType<T> getXmlAnnotatedItem()
+ protected AnnotatedClass<T> getXmlAnnotatedItem()
{
return xmlAnnotatedItem;
}
protected void initType()
{
+ // TODO This is not the right way to check XML definition
if (getAnnotatedItem().getDelegate() != null && getXmlAnnotatedItem().getDelegate() != null && !getAnnotatedItem().getDelegate().equals(getXmlAnnotatedItem().getDelegate()))
{
throw new IllegalArgumentException("Cannot build a bean which specifies different classes in XML and Java");
@@ -112,11 +113,11 @@
injectableFields = new HashSet<InjectableField<?>>();
for (AnnotatedField<Object> annotatedField : annotatedItem.getMetaAnnotatedFields(BindingType.class))
{
- if (Reflections.isStatic(annotatedField.getDelegate()))
+ if (annotatedField.isStatic())
{
throw new DefinitionException("Don't place binding annotations on static fields " + annotatedField);
}
- if (Reflections.isFinal(annotatedField.getDelegate()))
+ if (annotatedField.isFinal())
{
throw new DefinitionException("Don't place binding annotations on final fields " + annotatedField);
}
@@ -132,7 +133,7 @@
initializerMethods = new HashSet<InjectableMethod<Object>>();
for (AnnotatedMethod<Object> annotatedMethod : annotatedItem.getAnnotatedMethods(Initializer.class))
{
- if (Reflections.isStatic(annotatedMethod.getDelegate()))
+ if (annotatedMethod.isStatic())
{
throw new DefinitionException("Initializer method " + annotatedMethod.toString() + " cannot be static");
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/AbstractEnterpriseBeanModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/AbstractEnterpriseBeanModel.java 2008-11-05 12:27:30 UTC (rev 243)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/AbstractEnterpriseBeanModel.java 2008-11-05 13:02:04 UTC (rev 244)
@@ -8,7 +8,7 @@
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.ejb.EjbMetaData;
-import org.jboss.webbeans.introspector.AnnotatedType;
+import org.jboss.webbeans.introspector.AnnotatedClass;
public abstract class AbstractEnterpriseBeanModel<T> extends
AbstractClassBeanModel<T>
@@ -16,8 +16,8 @@
private EjbMetaData<T> ejbMetaData;
- public AbstractEnterpriseBeanModel(AnnotatedType<T> annotatedItem,
- AnnotatedType<T> xmlAnnotatedItem)
+ public AbstractEnterpriseBeanModel(AnnotatedClass<T> annotatedItem,
+ AnnotatedClass<T> xmlAnnotatedItem)
{
super(annotatedItem, xmlAnnotatedItem);
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/EnterpriseBeanModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/EnterpriseBeanModel.java 2008-11-05 12:27:30 UTC (rev 243)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/EnterpriseBeanModel.java 2008-11-05 13:02:04 UTC (rev 244)
@@ -21,8 +21,8 @@
import org.jboss.webbeans.injectable.EnterpriseConstructor;
import org.jboss.webbeans.injectable.InjectableMethod;
import org.jboss.webbeans.injectable.InjectableParameter;
-import org.jboss.webbeans.introspector.AnnotatedType;
-import org.jboss.webbeans.introspector.SimpleAnnotatedType;
+import org.jboss.webbeans.introspector.AnnotatedClass;
+import org.jboss.webbeans.introspector.SimpleAnnotatedClass;
import org.jboss.webbeans.util.Reflections;
public class EnterpriseBeanModel<T> extends AbstractEnterpriseBeanModel<T>
@@ -32,8 +32,8 @@
private String location;
- public EnterpriseBeanModel(AnnotatedType<T> annotatedItem,
- AnnotatedType<T> xmlAnnotatedItem, ManagerImpl container)
+ public EnterpriseBeanModel(AnnotatedClass<T> annotatedItem,
+ AnnotatedClass<T> xmlAnnotatedItem, ManagerImpl container)
{
super(annotatedItem, xmlAnnotatedItem);
init(container);
@@ -172,7 +172,7 @@
Class<?> superclass = getAnnotatedItem().getType().getSuperclass();
if ( superclass!=null )
{
- return new EnterpriseBeanModel(new SimpleAnnotatedType(superclass), getEmptyAnnotatedType(superclass), container);
+ return new EnterpriseBeanModel(new SimpleAnnotatedClass(superclass), getEmptyAnnotatedType(superclass), container);
}
else {
throw new RuntimeException();
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/EventBeanModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/EventBeanModel.java 2008-11-05 12:27:30 UTC (rev 243)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/EventBeanModel.java 2008-11-05 13:02:04 UTC (rev 244)
@@ -79,11 +79,13 @@
@Override
protected void initType()
{
+ // TODO This is not the right way to check XML definition
if (getXmlAnnotatedItem().getDelegate() != null)
{
log.finest("Bean type specified in XML");
this.type = xmlAnnotatedItem.getType();
- } else if (getAnnotatedItem().getDelegate() != null)
+ }
+ else if (getAnnotatedItem().getDelegate() != null)
{
log.finest("Bean type specified in Java");
this.type = annotatedItem.getType();
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/ProducerMethodBeanModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/ProducerMethodBeanModel.java 2008-11-05 12:27:30 UTC (rev 243)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/ProducerMethodBeanModel.java 2008-11-05 13:02:04 UTC (rev 244)
@@ -2,7 +2,6 @@
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.util.Set;
@@ -81,6 +80,7 @@
protected void initDeclaringBean(ManagerImpl container)
{
+ // TODO replace
declaringBean = container.getModelManager().getBeanModel(getAnnotatedItem().getDelegate().getDeclaringClass());
}
@@ -91,12 +91,12 @@
protected void checkProducerMethod()
{
- if (Modifier.isStatic(getAnnotatedItem().getDelegate().getModifiers()))
+ if (getAnnotatedItem().isStatic())
{
throw new RuntimeException("Producer method cannot be static " + annotatedMethod);
}
// TODO Check if declaring class is a WB bean
- if (!getScopeType().equals(Dependent.class) && Modifier.isFinal(getAnnotatedItem().getDelegate().getModifiers()))
+ if (!getScopeType().equals(Dependent.class) && getAnnotatedItem().isFinal())
{
throw new RuntimeException("Final producer method must have @Dependent scope " + annotatedMethod);
}
@@ -131,6 +131,7 @@
@Override
protected String getDefaultName()
{
+ // TODO Don't use delegate here
String propertyName = Reflections.getPropertyName(getAnnotatedItem().getDelegate());
if (propertyName != null)
{
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/SimpleBeanModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/SimpleBeanModel.java 2008-11-05 12:27:30 UTC (rev 243)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/bean/SimpleBeanModel.java 2008-11-05 13:02:04 UTC (rev 244)
@@ -10,8 +10,8 @@
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.injectable.InjectableParameter;
import org.jboss.webbeans.injectable.SimpleConstructor;
-import org.jboss.webbeans.introspector.AnnotatedType;
-import org.jboss.webbeans.introspector.SimpleAnnotatedType;
+import org.jboss.webbeans.introspector.AnnotatedClass;
+import org.jboss.webbeans.introspector.SimpleAnnotatedClass;
import org.jboss.webbeans.util.LoggerUtil;
import org.jboss.webbeans.util.Reflections;
@@ -30,7 +30,7 @@
* @param xmlAnnotatedItem Annotations read from XML
* @param container
*/
- public SimpleBeanModel(AnnotatedType<T> annotatedItem, AnnotatedType<T> xmlAnnotatedItem, ManagerImpl container)
+ public SimpleBeanModel(AnnotatedClass<T> annotatedItem, AnnotatedClass<T> xmlAnnotatedItem, ManagerImpl container)
{
super(annotatedItem, xmlAnnotatedItem);
init(container);
@@ -127,7 +127,7 @@
Class<?> superclass = getAnnotatedItem().getType().getSuperclass();
if ( superclass!=null )
{
- return new SimpleBeanModel(new SimpleAnnotatedType(superclass), getEmptyAnnotatedType(superclass), container);
+ return new SimpleBeanModel(new SimpleAnnotatedClass(superclass), getEmptyAnnotatedType(superclass), container);
}
else {
throw new RuntimeException();
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Reflections.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Reflections.java 2008-11-05 12:27:30 UTC (rev 243)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/util/Reflections.java 2008-11-05 13:02:04 UTC (rev 244)
@@ -5,6 +5,7 @@
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Member;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.ParameterizedType;
@@ -55,16 +56,11 @@
return Modifier.isFinal(clazz.getModifiers());
}
- public static boolean isFinal(Method method)
+ public static boolean isFinal(Member member)
{
- return Modifier.isFinal(method.getModifiers());
+ return Modifier.isFinal(member.getModifiers());
}
- public static boolean isFinal(Field field)
- {
- return Modifier.isFinal(field.getModifiers());
- }
-
public static boolean isTypeOrAnyMethodFinal(Class<?> type)
{
if (isFinal(type))
@@ -91,16 +87,11 @@
return Modifier.isStatic(type.getModifiers());
}
- public static boolean isStatic(Field field)
+ public static boolean isStatic(Member member)
{
- return Modifier.isStatic(field.getModifiers());
+ return Modifier.isStatic(member.getModifiers());
}
- public static boolean isStatic(Method method)
- {
- return Modifier.isStatic(method.getModifiers());
- }
-
public static boolean isAbstract(Class<?> clazz)
{
return Modifier.isAbstract(clazz.getModifiers());
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/BindingTypeTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/BindingTypeTest.java 2008-11-05 12:27:30 UTC (rev 243)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/BindingTypeTest.java 2008-11-05 13:02:04 UTC (rev 244)
@@ -11,8 +11,8 @@
import javax.webbeans.Current;
import org.jboss.webbeans.bindings.CurrentAnnotationLiteral;
-import org.jboss.webbeans.introspector.AnnotatedType;
-import org.jboss.webbeans.introspector.SimpleAnnotatedType;
+import org.jboss.webbeans.introspector.AnnotatedClass;
+import org.jboss.webbeans.introspector.SimpleAnnotatedClass;
import org.jboss.webbeans.model.bean.BeanModel;
import org.jboss.webbeans.model.bean.SimpleBeanModel;
import org.jboss.webbeans.test.annotations.Asynchronous;
@@ -85,7 +85,7 @@
{
Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
annotations.put(Asynchronous.class, new AsynchronousAnnotationLiteral());
- AnnotatedType annotatedItem = new SimpleAnnotatedType(Antelope.class, annotations);
+ AnnotatedClass annotatedItem = new SimpleAnnotatedClass(Antelope.class, annotations);
SimpleBeanModel<Antelope> antelope = new SimpleBeanModel<Antelope>(getEmptyAnnotatedType(Antelope.class), annotatedItem, manager);
assert Reflections.annotationSetMatches(antelope.getBindingTypes(), Asynchronous.class);
@@ -96,7 +96,7 @@
{
Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
annotations.put(Asynchronous.class, new AsynchronousAnnotationLiteral());
- AnnotatedType<Cat> annotatedItem = new SimpleAnnotatedType<Cat>(Cat.class, annotations);
+ AnnotatedClass<Cat> annotatedItem = new SimpleAnnotatedClass<Cat>(Cat.class, annotations);
SimpleBeanModel<Cat> cat = createSimpleModel(Cat.class, annotatedItem, manager);
assert cat.getBindingTypes().size() == 1;
@@ -107,7 +107,7 @@
public void testNoBindingTypesDeclaredInXml()
{
Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- AnnotatedType<Cat> annotatedItem = new SimpleAnnotatedType<Cat>(Cat.class, annotations);
+ AnnotatedClass<Cat> annotatedItem = new SimpleAnnotatedClass<Cat>(Cat.class, annotations);
SimpleBeanModel<Cat> cat = createSimpleModel(Cat.class, annotatedItem, manager);
assert cat.getBindingTypes().size() == 1;
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-11-05 12:27:30 UTC (rev 243)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ClassAnnotatedItemTest.java 2008-11-05 13:02:04 UTC (rev 244)
@@ -8,8 +8,8 @@
import javax.webbeans.Production;
import javax.webbeans.Stereotype;
-import org.jboss.webbeans.introspector.AnnotatedType;
-import org.jboss.webbeans.introspector.SimpleAnnotatedType;
+import org.jboss.webbeans.introspector.AnnotatedClass;
+import org.jboss.webbeans.introspector.SimpleAnnotatedClass;
import org.jboss.webbeans.test.beans.Antelope;
import org.jboss.webbeans.test.beans.Order;
import org.testng.annotations.Test;
@@ -20,7 +20,7 @@
@Test
public void testDeclaredAnnotations()
{
- AnnotatedType<Order> annotatedElement = new SimpleAnnotatedType<Order>(Order.class);
+ AnnotatedClass<Order> annotatedElement = new SimpleAnnotatedClass<Order>(Order.class);
assert annotatedElement.getAnnotations().size() == 1;
assert annotatedElement.getAnnotation(Production.class) != null;
assert annotatedElement.getAnnotatedClass().equals(Order.class);
@@ -29,7 +29,7 @@
@Test
public void testMetaAnnotations()
{
- AnnotatedType<Order> annotatedElement = new SimpleAnnotatedType<Order>(Order.class);
+ AnnotatedClass<Order> annotatedElement = new SimpleAnnotatedClass<Order>(Order.class);
Set<Annotation> annotations = annotatedElement.getAnnotations(DeploymentType.class);
assert annotations.size() == 1;
Iterator<Annotation> it = annotations.iterator();
@@ -40,10 +40,10 @@
@Test
public void testEmpty()
{
- AnnotatedType<Order> annotatedElement = new SimpleAnnotatedType<Order>(Order.class);
+ AnnotatedClass<Order> annotatedElement = new SimpleAnnotatedClass<Order>(Order.class);
assert annotatedElement.getAnnotation(Stereotype.class) == null;
assert annotatedElement.getAnnotations(Stereotype.class).size() == 0;
- AnnotatedType<Antelope> classWithNoAnnotations = new SimpleAnnotatedType<Antelope>(Antelope.class);
+ AnnotatedClass<Antelope> classWithNoAnnotations = new SimpleAnnotatedClass<Antelope>(Antelope.class);
assert classWithNoAnnotations.getAnnotations().size() == 0;
}
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeferredEventNotificationTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeferredEventNotificationTest.java 2008-11-05 12:27:30 UTC (rev 243)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeferredEventNotificationTest.java 2008-11-05 13:02:04 UTC (rev 244)
@@ -12,8 +12,8 @@
import org.jboss.webbeans.event.DeferredEventNotification;
import org.jboss.webbeans.injectable.InjectableMethod;
-import org.jboss.webbeans.introspector.AnnotatedType;
-import org.jboss.webbeans.introspector.SimpleAnnotatedType;
+import org.jboss.webbeans.introspector.AnnotatedClass;
+import org.jboss.webbeans.introspector.SimpleAnnotatedClass;
import org.jboss.webbeans.model.bean.SimpleBeanModel;
import org.jboss.webbeans.test.annotations.AnotherDeploymentType;
import org.jboss.webbeans.test.annotations.Asynchronous;
@@ -75,8 +75,8 @@
// Create an observer with known binding types
Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
annotations.put(Asynchronous.class, new AsynchronousAnnotationLiteral());
- AnnotatedType<Tuna> annotatedItem = new SimpleAnnotatedType<Tuna>(Tuna.class, annotations);
- tuna = new SimpleBeanModel<Tuna>(new SimpleAnnotatedType<Tuna>(Tuna.class), annotatedItem, manager);
+ AnnotatedClass<Tuna> annotatedItem = new SimpleAnnotatedClass<Tuna>(Tuna.class, annotations);
+ tuna = new SimpleBeanModel<Tuna>(new SimpleAnnotatedClass<Tuna>(Tuna.class), annotatedItem, manager);
om = new InjectableMethod<Object>(AnObserver.class.getMethod("observe", new Class[] { Event.class }));
AnObserver observerInstance = new AnObserver();
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeploymentTypeTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeploymentTypeTest.java 2008-11-05 12:27:30 UTC (rev 243)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeploymentTypeTest.java 2008-11-05 13:02:04 UTC (rev 244)
@@ -17,8 +17,8 @@
import javax.webbeans.UnsatisfiedDependencyException;
import javax.webbeans.manager.Bean;
-import org.jboss.webbeans.introspector.AnnotatedType;
-import org.jboss.webbeans.introspector.SimpleAnnotatedType;
+import org.jboss.webbeans.introspector.AnnotatedClass;
+import org.jboss.webbeans.introspector.SimpleAnnotatedClass;
import org.jboss.webbeans.model.bean.SimpleBeanModel;
import org.jboss.webbeans.test.annotations.AnotherDeploymentType;
import org.jboss.webbeans.test.annotations.FishStereotype;
@@ -66,7 +66,7 @@
@Test(expectedExceptions=DefinitionException.class) @SpecAssertion(section="2.5.3")
public void testTooManyDeploymentTypes()
{
- new SimpleBeanModel<BeanWithTooManyDeploymentTypes>(new SimpleAnnotatedType<BeanWithTooManyDeploymentTypes>(BeanWithTooManyDeploymentTypes.class), getEmptyAnnotatedType(BeanWithTooManyDeploymentTypes.class), manager);
+ new SimpleBeanModel<BeanWithTooManyDeploymentTypes>(new SimpleAnnotatedClass<BeanWithTooManyDeploymentTypes>(BeanWithTooManyDeploymentTypes.class), getEmptyAnnotatedType(BeanWithTooManyDeploymentTypes.class), manager);
}
@Test @SpecAssertion(section="2.5.4")
@@ -74,9 +74,9 @@
{
Map<Class<? extends Annotation>, Annotation> xmlDefinedDeploymentTypeAnnotations = new HashMap<Class<? extends Annotation>, Annotation>();
xmlDefinedDeploymentTypeAnnotations.put(AnotherDeploymentType.class, new AnotherDeploymentTypeAnnotationLiteral());
- AnnotatedType<BeanWithTooManyDeploymentTypes> xmlDefinedDeploymentTypeAnnotatedItem = new SimpleAnnotatedType<BeanWithTooManyDeploymentTypes>(BeanWithTooManyDeploymentTypes.class, xmlDefinedDeploymentTypeAnnotations);
+ AnnotatedClass<BeanWithTooManyDeploymentTypes> xmlDefinedDeploymentTypeAnnotatedItem = new SimpleAnnotatedClass<BeanWithTooManyDeploymentTypes>(BeanWithTooManyDeploymentTypes.class, xmlDefinedDeploymentTypeAnnotations);
- SimpleBeanModel<BeanWithTooManyDeploymentTypes> model = new SimpleBeanModel<BeanWithTooManyDeploymentTypes>(new SimpleAnnotatedType<BeanWithTooManyDeploymentTypes>(BeanWithTooManyDeploymentTypes.class), xmlDefinedDeploymentTypeAnnotatedItem, manager);
+ SimpleBeanModel<BeanWithTooManyDeploymentTypes> model = new SimpleBeanModel<BeanWithTooManyDeploymentTypes>(new SimpleAnnotatedClass<BeanWithTooManyDeploymentTypes>(BeanWithTooManyDeploymentTypes.class), xmlDefinedDeploymentTypeAnnotatedItem, manager);
assert model.getDeploymentType().equals(AnotherDeploymentType.class);
}
@@ -85,15 +85,15 @@
@Test @SpecAssertion(section="2.5.4")
public void testXmlRespectsJavaDeploymentType()
{
- AnnotatedType<Tuna> annotatedItem = new SimpleAnnotatedType<Tuna>(Tuna.class, new HashMap<Class<? extends Annotation>, Annotation>());
- SimpleBeanModel<Tuna> tuna = new SimpleBeanModel<Tuna>(new SimpleAnnotatedType<Tuna>(Tuna.class), annotatedItem, manager);
+ AnnotatedClass<Tuna> annotatedItem = new SimpleAnnotatedClass<Tuna>(Tuna.class, new HashMap<Class<? extends Annotation>, Annotation>());
+ SimpleBeanModel<Tuna> tuna = new SimpleBeanModel<Tuna>(new SimpleAnnotatedClass<Tuna>(Tuna.class), annotatedItem, manager);
assert tuna.getDeploymentType().equals(AnotherDeploymentType.class);
}
@Test @SpecAssertion(section="2.5.5")
public void testXmlDefaultDeploymentType()
{
- AnnotatedType<Antelope> antelopeAnnotatedItem = new SimpleAnnotatedType<Antelope>(Antelope.class, new HashMap<Class<? extends Annotation>, Annotation>());
+ AnnotatedClass<Antelope> antelopeAnnotatedItem = new SimpleAnnotatedClass<Antelope>(Antelope.class, new HashMap<Class<? extends Annotation>, Annotation>());
SimpleBeanModel<Antelope> antelope = new SimpleBeanModel<Antelope>(getEmptyAnnotatedType(Antelope.class), antelopeAnnotatedItem, manager);
assert antelope.getDeploymentType().equals(Production.class);
}
@@ -110,8 +110,8 @@
{
Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
annotations.put(FishStereotype.class, new FishStereotypeAnnotationLiteral());
- AnnotatedType<SeaBass> annotatedItem = new SimpleAnnotatedType<SeaBass>(SeaBass.class, annotations);
- SimpleBeanModel<SeaBass> trout = new SimpleBeanModel<SeaBass>(new SimpleAnnotatedType<SeaBass>(SeaBass.class), annotatedItem, manager);
+ AnnotatedClass<SeaBass> annotatedItem = new SimpleAnnotatedClass<SeaBass>(SeaBass.class, annotations);
+ SimpleBeanModel<SeaBass> trout = new SimpleBeanModel<SeaBass>(new SimpleAnnotatedClass<SeaBass>(SeaBass.class), annotatedItem, manager);
assert trout.getScopeType().equals(RequestScoped.class);
}
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NameTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NameTest.java 2008-11-05 12:27:30 UTC (rev 243)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NameTest.java 2008-11-05 13:02:04 UTC (rev 244)
@@ -11,8 +11,8 @@
import javax.webbeans.Named;
import org.jboss.webbeans.bindings.NamedAnnotationLiteral;
-import org.jboss.webbeans.introspector.AnnotatedType;
-import org.jboss.webbeans.introspector.SimpleAnnotatedType;
+import org.jboss.webbeans.introspector.AnnotatedClass;
+import org.jboss.webbeans.introspector.SimpleAnnotatedClass;
import org.jboss.webbeans.model.bean.BeanModel;
import org.jboss.webbeans.model.bean.SimpleBeanModel;
import org.jboss.webbeans.test.annotations.RiverFishStereotype;
@@ -37,7 +37,7 @@
@Test @SpecAssertion(section="2.6.1")
public void testNonDefaultNamed()
{
- SimpleBeanModel<Moose> moose = new SimpleBeanModel<Moose>(new SimpleAnnotatedType<Moose>(Moose.class), getEmptyAnnotatedType(Moose.class), manager);
+ SimpleBeanModel<Moose> moose = new SimpleBeanModel<Moose>(new SimpleAnnotatedClass<Moose>(Moose.class), getEmptyAnnotatedType(Moose.class), manager);
assert moose.getName().equals("aMoose");
}
@@ -53,8 +53,8 @@
}
});
- AnnotatedType<SeaBass> annotatedItem = new SimpleAnnotatedType<SeaBass>(SeaBass.class, annotations);
- SimpleBeanModel<SeaBass> trout = new SimpleBeanModel<SeaBass>(new SimpleAnnotatedType<SeaBass>(SeaBass.class), annotatedItem, manager);
+ AnnotatedClass<SeaBass> annotatedItem = new SimpleAnnotatedClass<SeaBass>(SeaBass.class, annotations);
+ SimpleBeanModel<SeaBass> trout = new SimpleBeanModel<SeaBass>(new SimpleAnnotatedClass<SeaBass>(SeaBass.class), annotatedItem, manager);
assert trout.getName().equals("aTrout");
}
@@ -71,8 +71,8 @@
}
});
- AnnotatedType<Cod> annotatedItem = new SimpleAnnotatedType<Cod>(Cod.class, annotations);
- SimpleBeanModel<Cod> cod = new SimpleBeanModel<Cod>(new SimpleAnnotatedType<Cod>(Cod.class), annotatedItem, manager);
+ AnnotatedClass<Cod> annotatedItem = new SimpleAnnotatedClass<Cod>(Cod.class, annotations);
+ SimpleBeanModel<Cod> cod = new SimpleBeanModel<Cod>(new SimpleAnnotatedClass<Cod>(Cod.class), annotatedItem, manager);
assert cod.getName().equals("aTrout");
}
@@ -81,8 +81,8 @@
public void testJavaNamedUsedWhenNoXmlSpecified()
{
Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- AnnotatedType<Cod> annotatedItem = new SimpleAnnotatedType<Cod>(Cod.class, annotations);
- SimpleBeanModel<Cod> cod = new SimpleBeanModel<Cod>(new SimpleAnnotatedType<Cod>(Cod.class), annotatedItem, manager);
+ AnnotatedClass<Cod> annotatedItem = new SimpleAnnotatedClass<Cod>(Cod.class, annotations);
+ SimpleBeanModel<Cod> cod = new SimpleBeanModel<Cod>(new SimpleAnnotatedClass<Cod>(Cod.class), annotatedItem, manager);
assert cod.getName().equals("whitefish");
}
@@ -90,7 +90,7 @@
@Test @SpecAssertion(section={"2.6.3", "3.2.7"})
public void testDefaultNamed()
{
- SimpleBeanModel<Haddock> haddock = new SimpleBeanModel<Haddock>(new SimpleAnnotatedType<Haddock>(Haddock.class), getEmptyAnnotatedType(Haddock.class), manager);
+ SimpleBeanModel<Haddock> haddock = new SimpleBeanModel<Haddock>(new SimpleAnnotatedClass<Haddock>(Haddock.class), getEmptyAnnotatedType(Haddock.class), manager);
assert haddock.getName() != null;
assert haddock.getName().equals("haddock");
}
@@ -107,8 +107,8 @@
}
});
- AnnotatedType<SeaBass> annotatedItem = new SimpleAnnotatedType<SeaBass>(SeaBass.class, annotations);
- SimpleBeanModel<SeaBass> trout = new SimpleBeanModel<SeaBass>(new SimpleAnnotatedType<SeaBass>(SeaBass.class), annotatedItem, manager);
+ AnnotatedClass<SeaBass> annotatedItem = new SimpleAnnotatedClass<SeaBass>(SeaBass.class, annotations);
+ SimpleBeanModel<SeaBass> trout = new SimpleBeanModel<SeaBass>(new SimpleAnnotatedClass<SeaBass>(SeaBass.class), annotatedItem, manager);
assert trout.getName() != null;
assert trout.getName().equals("seaBass");
@@ -125,14 +125,14 @@
@Test @SpecAssertion(section="2.6.4")
public void testNotNamedInJava()
{
- SimpleBeanModel<SeaBass> model = new SimpleBeanModel<SeaBass>(new SimpleAnnotatedType<SeaBass>(SeaBass.class), getEmptyAnnotatedType(SeaBass.class), manager);
+ SimpleBeanModel<SeaBass> model = new SimpleBeanModel<SeaBass>(new SimpleAnnotatedClass<SeaBass>(SeaBass.class), getEmptyAnnotatedType(SeaBass.class), manager);
assert model.getName() == null;
}
@Test @SpecAssertion(section="2.6.4")
public void testNotNamedInXml()
{
- SimpleBeanModel<SeaBass> model = new SimpleBeanModel<SeaBass>(new SimpleAnnotatedType<SeaBass>(SeaBass.class), getEmptyAnnotatedType(SeaBass.class), manager);
+ SimpleBeanModel<SeaBass> model = new SimpleBeanModel<SeaBass>(new SimpleAnnotatedClass<SeaBass>(SeaBass.class), getEmptyAnnotatedType(SeaBass.class), manager);
assert model.getName() == null;
}
@@ -141,8 +141,8 @@
{
Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
annotations.put(RiverFishStereotype.class, new RiverFishStereotypeAnnotationLiteral());
- AnnotatedType<SeaBass> annotatedItem = new SimpleAnnotatedType<SeaBass>(SeaBass.class, annotations);
- SimpleBeanModel<SeaBass> model = new SimpleBeanModel<SeaBass>(new SimpleAnnotatedType<SeaBass>(SeaBass.class), annotatedItem, manager);
+ AnnotatedClass<SeaBass> annotatedItem = new SimpleAnnotatedClass<SeaBass>(SeaBass.class, annotations);
+ SimpleBeanModel<SeaBass> model = new SimpleBeanModel<SeaBass>(new SimpleAnnotatedClass<SeaBass>(SeaBass.class), annotatedItem, manager);
assert model.getName() == null;
}
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NormalContextTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NormalContextTest.java 2008-11-05 12:27:30 UTC (rev 243)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/NormalContextTest.java 2008-11-05 13:02:04 UTC (rev 244)
@@ -11,7 +11,7 @@
import org.jboss.webbeans.contexts.AbstractContext;
import org.jboss.webbeans.contexts.RequestContext;
import org.jboss.webbeans.introspector.SimpleAnnotatedMethod;
-import org.jboss.webbeans.introspector.SimpleAnnotatedType;
+import org.jboss.webbeans.introspector.SimpleAnnotatedClass;
import org.jboss.webbeans.model.bean.ProducerMethodBeanModel;
import org.jboss.webbeans.model.bean.SimpleBeanModel;
import org.jboss.webbeans.test.beans.SpiderProducer;
@@ -68,7 +68,7 @@
@Test(groups={"contexts", "producerMethod"}) @SpecAssertion(section="8.1")
public void testProducerMethodReturningNullOK() throws SecurityException, NoSuchMethodException {
- SimpleBeanModel<SpiderProducer> producer = new SimpleBeanModel<SpiderProducer>(new SimpleAnnotatedType<SpiderProducer>(SpiderProducer.class), getEmptyAnnotatedType(SpiderProducer.class), manager);
+ SimpleBeanModel<SpiderProducer> producer = new SimpleBeanModel<SpiderProducer>(new SimpleAnnotatedClass<SpiderProducer>(SpiderProducer.class), getEmptyAnnotatedType(SpiderProducer.class), manager);
manager.getModelManager().addBeanModel(producer);
Method nullProducer = SpiderProducer.class.getMethod("produceShelob");
ProducerMethodBeanModel<Tarantula> producerModel = new ProducerMethodBeanModel<Tarantula>(new SimpleAnnotatedMethod<Tarantula>(nullProducer), manager);
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ObserverTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ObserverTest.java 2008-11-05 12:27:30 UTC (rev 243)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ObserverTest.java 2008-11-05 13:02:04 UTC (rev 244)
@@ -11,8 +11,8 @@
import javax.webbeans.Standard;
import org.jboss.webbeans.injectable.InjectableMethod;
-import org.jboss.webbeans.introspector.AnnotatedType;
-import org.jboss.webbeans.introspector.SimpleAnnotatedType;
+import org.jboss.webbeans.introspector.AnnotatedClass;
+import org.jboss.webbeans.introspector.SimpleAnnotatedClass;
import org.jboss.webbeans.model.bean.SimpleBeanModel;
import org.jboss.webbeans.test.annotations.AnotherDeploymentType;
import org.jboss.webbeans.test.annotations.Asynchronous;
@@ -64,8 +64,8 @@
// Create an observer with known binding types
Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
annotations.put(Asynchronous.class, new AsynchronousAnnotationLiteral());
- AnnotatedType<Tuna> annotatedItem = new SimpleAnnotatedType<Tuna>(Tuna.class, annotations);
- tuna = new SimpleBeanModel<Tuna>(new SimpleAnnotatedType<Tuna>(Tuna.class), annotatedItem, manager);
+ AnnotatedClass<Tuna> annotatedItem = new SimpleAnnotatedClass<Tuna>(Tuna.class, annotations);
+ tuna = new SimpleBeanModel<Tuna>(new SimpleAnnotatedClass<Tuna>(Tuna.class), annotatedItem, manager);
om = new InjectableMethod<Object>(AnObserver.class.getMethod("observe", new Class[] { SampleEvent.class }));
}
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerMethodBeanModelTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerMethodBeanModelTest.java 2008-11-05 12:27:30 UTC (rev 243)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ProducerMethodBeanModelTest.java 2008-11-05 13:02:04 UTC (rev 244)
@@ -8,7 +8,7 @@
import javax.webbeans.Dependent;
import org.jboss.webbeans.introspector.SimpleAnnotatedMethod;
-import org.jboss.webbeans.introspector.SimpleAnnotatedType;
+import org.jboss.webbeans.introspector.SimpleAnnotatedClass;
import org.jboss.webbeans.model.bean.ProducerMethodBeanModel;
import org.jboss.webbeans.model.bean.SimpleBeanModel;
import org.jboss.webbeans.test.annotations.AnotherDeploymentType;
@@ -33,7 +33,7 @@
@Test(groups="producerMethod") @SpecAssertion(section="2.5.3")
public void testProducerMethodInheritsDeploymentTypeOfDeclaringWebBean() throws Exception
{
- SimpleBeanModel<SpiderProducer> model = new SimpleBeanModel<SpiderProducer>(new SimpleAnnotatedType<SpiderProducer>(SpiderProducer.class), getEmptyAnnotatedType(SpiderProducer.class), manager);
+ SimpleBeanModel<SpiderProducer> model = new SimpleBeanModel<SpiderProducer>(new SimpleAnnotatedClass<SpiderProducer>(SpiderProducer.class), getEmptyAnnotatedType(SpiderProducer.class), manager);
manager.getModelManager().addBeanModel(model);
Method method = SpiderProducer.class.getMethod("produceTameTarantula");
ProducerMethodBeanModel<Tarantula> tarantulaModel = new ProducerMethodBeanModel<Tarantula>(new SimpleAnnotatedMethod<Tarantula>(method), manager);
@@ -43,7 +43,7 @@
@Test(groups="producerMethod") @SpecAssertion(section="3.3")
public void testStaticMethod() throws SecurityException, NoSuchMethodException
{
- SimpleBeanModel<BeanWithStaticProducerMethod> model = new SimpleBeanModel<BeanWithStaticProducerMethod>(new SimpleAnnotatedType<BeanWithStaticProducerMethod>(BeanWithStaticProducerMethod.class), getEmptyAnnotatedType(BeanWithStaticProducerMethod.class), manager);
+ SimpleBeanModel<BeanWithStaticProducerMethod> model = new SimpleBeanModel<BeanWithStaticProducerMethod>(new SimpleAnnotatedClass<BeanWithStaticProducerMethod>(BeanWithStaticProducerMethod.class), getEmptyAnnotatedType(BeanWithStaticProducerMethod.class), manager);
manager.getModelManager().addBeanModel(model);
Method method = BeanWithStaticProducerMethod.class.getMethod("getString");
boolean exception = false;
@@ -61,7 +61,7 @@
@Test(groups="producerMethod") @SpecAssertion(section="3.3")
public void testApiTypes() throws SecurityException, NoSuchMethodException
{
- SimpleBeanModel<SpiderProducer> model = new SimpleBeanModel<SpiderProducer>(new SimpleAnnotatedType<SpiderProducer>(SpiderProducer.class), getEmptyAnnotatedType(SpiderProducer.class), manager);
+ SimpleBeanModel<SpiderProducer> model = new SimpleBeanModel<SpiderProducer>(new SimpleAnnotatedClass<SpiderProducer>(SpiderProducer.class), getEmptyAnnotatedType(SpiderProducer.class), manager);
manager.getModelManager().addBeanModel(model);
Method method = SpiderProducer.class.getMethod("produceTarantula");
ProducerMethodBeanModel<Tarantula> tarantulaModel = new ProducerMethodBeanModel<Tarantula>(new SimpleAnnotatedMethod<Tarantula>(method), manager);
@@ -76,7 +76,7 @@
@Test(groups="producerMethod") @SpecAssertion(section="3.3.1")
public void testDefaultBindingType() throws SecurityException, NoSuchMethodException
{
- SimpleBeanModel<SpiderProducer> model = new SimpleBeanModel<SpiderProducer>(new SimpleAnnotatedType<SpiderProducer>(SpiderProducer.class), getEmptyAnnotatedType(SpiderProducer.class), manager);
+ SimpleBeanModel<SpiderProducer> model = new SimpleBeanModel<SpiderProducer>(new SimpleAnnotatedClass<SpiderProducer>(SpiderProducer.class), getEmptyAnnotatedType(SpiderProducer.class), manager);
manager.getModelManager().addBeanModel(model);
Method method = SpiderProducer.class.getMethod("produceTarantula");
ProducerMethodBeanModel<Tarantula> tarantulaModel = new ProducerMethodBeanModel<Tarantula>(new SimpleAnnotatedMethod<Tarantula>(method), manager);
@@ -87,7 +87,7 @@
@Test(groups="producerMethod")
public void testBindingType() throws SecurityException, NoSuchMethodException
{
- SimpleBeanModel<SpiderProducer> model = new SimpleBeanModel<SpiderProducer>(new SimpleAnnotatedType<SpiderProducer>(SpiderProducer.class), getEmptyAnnotatedType(SpiderProducer.class), manager);
+ SimpleBeanModel<SpiderProducer> model = new SimpleBeanModel<SpiderProducer>(new SimpleAnnotatedClass<SpiderProducer>(SpiderProducer.class), getEmptyAnnotatedType(SpiderProducer.class), manager);
manager.getModelManager().addBeanModel(model);
Method method = SpiderProducer.class.getMethod("produceTameTarantula");
ProducerMethodBeanModel<Tarantula> tarantulaModel = new ProducerMethodBeanModel<Tarantula>(new SimpleAnnotatedMethod<Tarantula>(method), manager);
@@ -98,7 +98,7 @@
@Test(groups="producerMethod") @SpecAssertion(section="3.3")
public void testFinalMethod() throws SecurityException, NoSuchMethodException
{
- SimpleBeanModel<BeanWithFinalProducerMethod> model = new SimpleBeanModel<BeanWithFinalProducerMethod>(new SimpleAnnotatedType<BeanWithFinalProducerMethod>(BeanWithFinalProducerMethod.class), getEmptyAnnotatedType(BeanWithFinalProducerMethod.class), manager);
+ SimpleBeanModel<BeanWithFinalProducerMethod> model = new SimpleBeanModel<BeanWithFinalProducerMethod>(new SimpleAnnotatedClass<BeanWithFinalProducerMethod>(BeanWithFinalProducerMethod.class), getEmptyAnnotatedType(BeanWithFinalProducerMethod.class), manager);
manager.getModelManager().addBeanModel(model);
Method method = BeanWithFinalProducerMethod.class.getMethod("getString");
boolean exception = false;
@@ -116,7 +116,7 @@
@Test(groups="producerMethod") @SpecAssertion(section="3.3")
public void testFinalMethodWithDependentScope() throws SecurityException, NoSuchMethodException
{
- SimpleBeanModel<SpiderProducer> model = new SimpleBeanModel<SpiderProducer>(new SimpleAnnotatedType<SpiderProducer>(SpiderProducer.class), getEmptyAnnotatedType(SpiderProducer.class), manager);
+ SimpleBeanModel<SpiderProducer> model = new SimpleBeanModel<SpiderProducer>(new SimpleAnnotatedClass<SpiderProducer>(SpiderProducer.class), getEmptyAnnotatedType(SpiderProducer.class), manager);
manager.getModelManager().addBeanModel(model);
Method method = SpiderProducer.class.getMethod("produceTrapdoorSpider");
ProducerMethodBeanModel<TrapdoorSpider> trapdoorSpiderModel = new ProducerMethodBeanModel<TrapdoorSpider>(new SimpleAnnotatedMethod<TrapdoorSpider>(method), manager);
@@ -126,7 +126,7 @@
@Test(groups="producerMethod") @SpecAssertion(section="3.3.6")
public void testNamedMethod() throws SecurityException, NoSuchMethodException
{
- SimpleBeanModel<SpiderProducer> model = new SimpleBeanModel<SpiderProducer>(new SimpleAnnotatedType<SpiderProducer>(SpiderProducer.class), getEmptyAnnotatedType(SpiderProducer.class), manager);
+ SimpleBeanModel<SpiderProducer> model = new SimpleBeanModel<SpiderProducer>(new SimpleAnnotatedClass<SpiderProducer>(SpiderProducer.class), getEmptyAnnotatedType(SpiderProducer.class), manager);
manager.getModelManager().addBeanModel(model);
Method method = SpiderProducer.class.getMethod("produceBlackWidow");
ProducerMethodBeanModel<BlackWidow> blackWidowSpiderModel = new ProducerMethodBeanModel<BlackWidow>(new SimpleAnnotatedMethod<BlackWidow>(method), manager);
@@ -136,7 +136,7 @@
@Test(groups="producerMethod") @SpecAssertion(section="3.3.6")
public void testDefaultNamedMethod() throws SecurityException, NoSuchMethodException
{
- SimpleBeanModel<SpiderProducer> model = new SimpleBeanModel<SpiderProducer>(new SimpleAnnotatedType<SpiderProducer>(SpiderProducer.class), getEmptyAnnotatedType(SpiderProducer.class), manager);
+ SimpleBeanModel<SpiderProducer> model = new SimpleBeanModel<SpiderProducer>(new SimpleAnnotatedClass<SpiderProducer>(SpiderProducer.class), getEmptyAnnotatedType(SpiderProducer.class), manager);
manager.getModelManager().addBeanModel(model);
Method method = SpiderProducer.class.getMethod("produceDaddyLongLegs");
ProducerMethodBeanModel<DaddyLongLegs> daddyLongLegsSpiderModel = new ProducerMethodBeanModel<DaddyLongLegs>(new SimpleAnnotatedMethod<DaddyLongLegs>(method), manager);
@@ -146,7 +146,7 @@
@Test(groups="producerMethod") @SpecAssertion(section="3.3.6")
public void testDefaultNamedJavaBeanMethod() throws SecurityException, NoSuchMethodException
{
- SimpleBeanModel<SpiderProducer> model = new SimpleBeanModel<SpiderProducer>(new SimpleAnnotatedType<SpiderProducer>(SpiderProducer.class), getEmptyAnnotatedType(SpiderProducer.class), manager);
+ SimpleBeanModel<SpiderProducer> model = new SimpleBeanModel<SpiderProducer>(new SimpleAnnotatedClass<SpiderProducer>(SpiderProducer.class), getEmptyAnnotatedType(SpiderProducer.class), manager);
manager.getModelManager().addBeanModel(model);
Method method = SpiderProducer.class.getMethod("getLadybirdSpider");
ProducerMethodBeanModel<LadybirdSpider> ladybirdSpiderModel = new ProducerMethodBeanModel<LadybirdSpider>(new SimpleAnnotatedMethod<LadybirdSpider>(method), manager);
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ScopeTypeTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ScopeTypeTest.java 2008-11-05 12:27:30 UTC (rev 243)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ScopeTypeTest.java 2008-11-05 13:02:04 UTC (rev 244)
@@ -16,8 +16,8 @@
import org.jboss.webbeans.bindings.ConversationScopedAnnotationLiteral;
import org.jboss.webbeans.bindings.RequestScopedAnnotationLiteral;
-import org.jboss.webbeans.introspector.AnnotatedType;
-import org.jboss.webbeans.introspector.SimpleAnnotatedType;
+import org.jboss.webbeans.introspector.AnnotatedClass;
+import org.jboss.webbeans.introspector.SimpleAnnotatedClass;
import org.jboss.webbeans.model.bean.SimpleBeanModel;
import org.jboss.webbeans.test.annotations.AnimalStereotype;
import org.jboss.webbeans.test.annotations.AnotherScopeType;
@@ -67,14 +67,14 @@
@Test @SpecAssertion(section="2.4.3")
public void testScopeDeclaredInJava()
{
- SimpleBeanModel<SeaBass> trout = new SimpleBeanModel<SeaBass>(new SimpleAnnotatedType<SeaBass>(SeaBass.class), getEmptyAnnotatedType(SeaBass.class), manager);
+ SimpleBeanModel<SeaBass> trout = new SimpleBeanModel<SeaBass>(new SimpleAnnotatedClass<SeaBass>(SeaBass.class), getEmptyAnnotatedType(SeaBass.class), manager);
assert trout.getScopeType().equals(RequestScoped.class);
}
@Test(expectedExceptions=DefinitionException.class) @SpecAssertion(section="2.4.3")
public void testTooManyScopesSpecifiedInJava()
{
- new SimpleBeanModel<BeanWithTooManyScopeTypes>(new SimpleAnnotatedType<BeanWithTooManyScopeTypes>(BeanWithTooManyScopeTypes.class), getEmptyAnnotatedType(BeanWithTooManyScopeTypes.class), manager);
+ new SimpleBeanModel<BeanWithTooManyScopeTypes>(new SimpleAnnotatedClass<BeanWithTooManyScopeTypes>(BeanWithTooManyScopeTypes.class), getEmptyAnnotatedType(BeanWithTooManyScopeTypes.class), manager);
}
@Test(expectedExceptions=DefinitionException.class)
@@ -83,7 +83,7 @@
Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
annotations.put(RequestScoped.class, new RequestScopedAnnotationLiteral());
annotations.put(ConversationScoped.class, new ConversationScopedAnnotationLiteral());
- AnnotatedType<Antelope> antelopeAnnotatedItem = new SimpleAnnotatedType<Antelope>(Antelope.class, annotations);
+ AnnotatedClass<Antelope> antelopeAnnotatedItem = new SimpleAnnotatedClass<Antelope>(Antelope.class, annotations);
new SimpleBeanModel<Antelope>(getEmptyAnnotatedType(Antelope.class), antelopeAnnotatedItem, manager);
}
@@ -92,9 +92,9 @@
{
Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
annotations.put(RequestScoped.class, new RequestScopedAnnotationLiteral());
- AnnotatedType<Order> annotatedItem = new SimpleAnnotatedType<Order>(Order.class, annotations);
+ AnnotatedClass<Order> annotatedItem = new SimpleAnnotatedClass<Order>(Order.class, annotations);
- SimpleBeanModel<Order> order = new SimpleBeanModel<Order>(new SimpleAnnotatedType<Order>(Order.class), annotatedItem, manager);
+ SimpleBeanModel<Order> order = new SimpleBeanModel<Order>(new SimpleAnnotatedClass<Order>(Order.class), annotatedItem, manager);
assert order.getScopeType().equals(RequestScoped.class);
}
@@ -102,9 +102,9 @@
public void testScopeMissingInXml()
{
Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
- AnnotatedType<SeaBass> annotatedItem = new SimpleAnnotatedType<SeaBass>(SeaBass.class, annotations);
+ AnnotatedClass<SeaBass> annotatedItem = new SimpleAnnotatedClass<SeaBass>(SeaBass.class, annotations);
- SimpleBeanModel<SeaBass> trout = new SimpleBeanModel<SeaBass>(new SimpleAnnotatedType<SeaBass>(SeaBass.class), annotatedItem, manager);
+ SimpleBeanModel<SeaBass> trout = new SimpleBeanModel<SeaBass>(new SimpleAnnotatedClass<SeaBass>(SeaBass.class), annotatedItem, manager);
assert trout.getScopeType().equals(RequestScoped.class);
}
@@ -113,15 +113,15 @@
{
Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
annotations.put(ConversationScoped.class, new ConversationScopedAnnotationLiteral());
- AnnotatedType<SeaBass> annotatedItem = new SimpleAnnotatedType<SeaBass>(SeaBass.class, annotations);
- SimpleBeanModel<SeaBass> trout = new SimpleBeanModel<SeaBass>(new SimpleAnnotatedType<SeaBass>(SeaBass.class), annotatedItem, manager);
+ AnnotatedClass<SeaBass> annotatedItem = new SimpleAnnotatedClass<SeaBass>(SeaBass.class, annotations);
+ SimpleBeanModel<SeaBass> trout = new SimpleBeanModel<SeaBass>(new SimpleAnnotatedClass<SeaBass>(SeaBass.class), annotatedItem, manager);
assert trout.getScopeType().equals(ConversationScoped.class);
}
@Test @SpecAssertion(section="2.4.5")
public void testDefaultScope()
{
- SimpleBeanModel<Order> order = new SimpleBeanModel<Order>(new SimpleAnnotatedType<Order>(Order.class), getEmptyAnnotatedType(Order.class), manager);
+ SimpleBeanModel<Order> order = new SimpleBeanModel<Order>(new SimpleAnnotatedClass<Order>(Order.class), getEmptyAnnotatedType(Order.class), manager);
assert order.getScopeType().equals(Dependent.class);
}
@@ -130,8 +130,8 @@
{
Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
annotations.put(FishStereotype.class, new FishStereotypeAnnotationLiteral());
- AnnotatedType<SeaBass> annotatedItem = new SimpleAnnotatedType<SeaBass>(SeaBass.class, annotations);
- SimpleBeanModel<SeaBass> trout = new SimpleBeanModel<SeaBass>(new SimpleAnnotatedType<SeaBass>(SeaBass.class), annotatedItem, manager);
+ AnnotatedClass<SeaBass> annotatedItem = new SimpleAnnotatedClass<SeaBass>(SeaBass.class, annotations);
+ SimpleBeanModel<SeaBass> trout = new SimpleBeanModel<SeaBass>(new SimpleAnnotatedClass<SeaBass>(SeaBass.class), annotatedItem, manager);
assert trout.getScopeType().equals(RequestScoped.class);
}
@@ -141,12 +141,12 @@
Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
annotations.put(FishStereotype.class, new FishStereotypeAnnotationLiteral());
annotations.put(AnimalStereotype.class, new AnimalStereotypeAnnotationLiteral());
- AnnotatedType<Haddock> annotatedItem = new SimpleAnnotatedType<Haddock>(Haddock.class, annotations);
+ AnnotatedClass<Haddock> annotatedItem = new SimpleAnnotatedClass<Haddock>(Haddock.class, annotations);
boolean exception = false;
try
{
- new SimpleBeanModel<Haddock>(new SimpleAnnotatedType<Haddock>(Haddock.class), annotatedItem, manager);
+ new SimpleBeanModel<Haddock>(new SimpleAnnotatedClass<Haddock>(Haddock.class), annotatedItem, manager);
}
catch (Exception e)
{
@@ -161,9 +161,9 @@
Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
annotations.put(FishStereotype.class, new FishStereotypeAnnotationLiteral());
annotations.put(AnimalStereotype.class, new AnimalStereotypeAnnotationLiteral());
- AnnotatedType<SeaBass> annotatedItem = new SimpleAnnotatedType<SeaBass>(SeaBass.class, annotations);
+ AnnotatedClass<SeaBass> annotatedItem = new SimpleAnnotatedClass<SeaBass>(SeaBass.class, annotations);
- SimpleBeanModel<SeaBass> trout = new SimpleBeanModel<SeaBass>(new SimpleAnnotatedType<SeaBass>(SeaBass.class), annotatedItem, manager);
+ SimpleBeanModel<SeaBass> trout = new SimpleBeanModel<SeaBass>(new SimpleAnnotatedClass<SeaBass>(SeaBass.class), annotatedItem, manager);
assert trout.getScopeType().equals(RequestScoped.class);
}
@@ -173,9 +173,9 @@
Map<Class<? extends Annotation>, Annotation> annotations = new HashMap<Class<? extends Annotation>, Annotation>();
annotations.put(FishStereotype.class, new FishStereotypeAnnotationLiteral());
annotations.put(RiverFishStereotype.class, new RiverFishStereotypeAnnotationLiteral());
- AnnotatedType<Haddock> annotatedItem = new SimpleAnnotatedType<Haddock>(Haddock.class, annotations);
+ AnnotatedClass<Haddock> annotatedItem = new SimpleAnnotatedClass<Haddock>(Haddock.class, annotations);
- SimpleBeanModel<Haddock> haddock = new SimpleBeanModel<Haddock>(new SimpleAnnotatedType<Haddock>(Haddock.class), annotatedItem, manager);
+ SimpleBeanModel<Haddock> haddock = new SimpleBeanModel<Haddock>(new SimpleAnnotatedClass<Haddock>(Haddock.class), annotatedItem, manager);
assert haddock.getScopeType().equals(ApplicationScoped.class);
}
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleBeanModelTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleBeanModelTest.java 2008-11-05 12:27:30 UTC (rev 243)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/SimpleBeanModelTest.java 2008-11-05 13:02:04 UTC (rev 244)
@@ -13,7 +13,7 @@
import org.jboss.webbeans.bindings.CurrentAnnotationLiteral;
import org.jboss.webbeans.injectable.InjectableParameter;
import org.jboss.webbeans.injectable.SimpleConstructor;
-import org.jboss.webbeans.introspector.SimpleAnnotatedType;
+import org.jboss.webbeans.introspector.SimpleAnnotatedClass;
import org.jboss.webbeans.model.bean.SimpleBeanModel;
import org.jboss.webbeans.test.annotations.HeavyDuty;
import org.jboss.webbeans.test.annotations.Motorized;
@@ -45,26 +45,26 @@
@Test(expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.2")
public void testAbstractClassDeclaredInJavaIsNotAllowed()
{
- new SimpleBeanModel<Cow>(new SimpleAnnotatedType<Cow>(Cow.class), getEmptyAnnotatedType(Cow.class), manager);
+ new SimpleBeanModel<Cow>(new SimpleAnnotatedClass<Cow>(Cow.class), getEmptyAnnotatedType(Cow.class), manager);
}
@Test(groups="innerClass") @SpecAssertion(section="3.2")
public void testStaticInnerClassDeclaredInJavaAllowed()
{
- new SimpleBeanModel<StaticInnerBean>(new SimpleAnnotatedType<StaticInnerBean>(StaticInnerBean.class), getEmptyAnnotatedType(StaticInnerBean.class), manager);
+ new SimpleBeanModel<StaticInnerBean>(new SimpleAnnotatedClass<StaticInnerBean>(StaticInnerBean.class), getEmptyAnnotatedType(StaticInnerBean.class), manager);
}
@Test(expectedExceptions=DefinitionException.class, groups="innerClass") @SpecAssertion(section="3.2")
public void testNonStaticInnerClassDeclaredInJavaNotAllowed()
{
- new SimpleBeanModel<InnerBean>(new SimpleAnnotatedType<InnerBean>(InnerBean.class), getEmptyAnnotatedType(InnerBean.class), manager);
+ new SimpleBeanModel<InnerBean>(new SimpleAnnotatedClass<InnerBean>(InnerBean.class), getEmptyAnnotatedType(InnerBean.class), manager);
}
@SuppressWarnings("unchecked")
@Test(expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.2")
public void testParameterizedClassDeclaredInJavaIsNotAllowed()
{
- new SimpleBeanModel<ParameterizedBean>(new SimpleAnnotatedType<ParameterizedBean>(ParameterizedBean.class), getEmptyAnnotatedType(ParameterizedBean.class), manager);
+ new SimpleBeanModel<ParameterizedBean>(new SimpleAnnotatedClass<ParameterizedBean>(ParameterizedBean.class), getEmptyAnnotatedType(ParameterizedBean.class), manager);
}
@Test(expectedExceptions=DefinitionException.class, groups={"interceptors", "decorators"}) @SpecAssertion(section="3.2")
@@ -113,19 +113,19 @@
@Test(expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.2.4")
public void testAbstractClassDeclaredInXmlIsNotAllowed()
{
- new SimpleBeanModel<Cow>(new SimpleAnnotatedType<Cow>(Cow.class), getEmptyAnnotatedType(Cow.class), manager);
+ new SimpleBeanModel<Cow>(new SimpleAnnotatedClass<Cow>(Cow.class), getEmptyAnnotatedType(Cow.class), manager);
}
@Test(groups="innerClass") @SpecAssertion(section="3.2.4")
public void testStaticInnerClassDeclaredInXmlAllowed()
{
- new SimpleBeanModel<StaticInnerBean>(new SimpleAnnotatedType<StaticInnerBean>(StaticInnerBean.class), getEmptyAnnotatedType(StaticInnerBean.class), manager);
+ new SimpleBeanModel<StaticInnerBean>(new SimpleAnnotatedClass<StaticInnerBean>(StaticInnerBean.class), getEmptyAnnotatedType(StaticInnerBean.class), manager);
}
@Test(expectedExceptions=DefinitionException.class, groups="innerClass") @SpecAssertion(section="3.2.4")
public void testNonStaticInnerClassDeclaredInXmlNotAllowed()
{
- new SimpleBeanModel<InnerBean>(new SimpleAnnotatedType<InnerBean>(InnerBean.class), getEmptyAnnotatedType(InnerBean.class), manager);
+ new SimpleBeanModel<InnerBean>(new SimpleAnnotatedClass<InnerBean>(InnerBean.class), getEmptyAnnotatedType(InnerBean.class), manager);
}
@Test(expectedExceptions=DefinitionException.class, groups="webbeansxml") @SpecAssertion(section="3.2.4")
@@ -149,7 +149,7 @@
@Test @SpecAssertion(section="3.2.5.1")
public void testInitializerAnnotatedConstructor()
{
- SimpleConstructor<Sheep> constructor = new SimpleBeanModel<Sheep>(new SimpleAnnotatedType<Sheep>(Sheep.class), getEmptyAnnotatedType(Sheep.class), manager).getConstructor();
+ SimpleConstructor<Sheep> constructor = new SimpleBeanModel<Sheep>(new SimpleAnnotatedClass<Sheep>(Sheep.class), getEmptyAnnotatedType(Sheep.class), manager).getConstructor();
assert constructor.getAnnotatedItem().getDelegate().getDeclaringClass().equals(Sheep.class);
assert constructor.getAnnotatedItem().getDelegate().getParameterTypes().length == 2;
assert constructor.getAnnotatedItem().getDelegate().getParameterTypes()[0].equals(String.class);
@@ -166,7 +166,7 @@
@Test @SpecAssertion(section="3.2.5.1")
public void testImplicitConstructorUsed()
{
- SimpleConstructor<Order> constructor = new SimpleBeanModel<Order>(new SimpleAnnotatedType<Order>(Order.class), getEmptyAnnotatedType(Order.class), manager).getConstructor();
+ SimpleConstructor<Order> constructor = new SimpleBeanModel<Order>(new SimpleAnnotatedClass<Order>(Order.class), getEmptyAnnotatedType(Order.class), manager).getConstructor();
assert constructor.getAnnotatedItem().getDelegate().getDeclaringClass().equals(Order.class);
assert constructor.getAnnotatedItem().getDelegate().getParameterTypes().length == 0;
assert constructor.getParameters().size() == 0;
@@ -175,7 +175,7 @@
@Test @SpecAssertion(section="3.2.5.1")
public void testEmptyConstructorUsed()
{
- SimpleConstructor<Donkey> constructor = new SimpleBeanModel<Donkey>(new SimpleAnnotatedType<Donkey>(Donkey.class), getEmptyAnnotatedType(Donkey.class), manager).getConstructor();
+ SimpleConstructor<Donkey> constructor = new SimpleBeanModel<Donkey>(new SimpleAnnotatedClass<Donkey>(Donkey.class), getEmptyAnnotatedType(Donkey.class), manager).getConstructor();
assert constructor.getAnnotatedItem().getDelegate().getDeclaringClass().equals(Donkey.class);
assert constructor.getAnnotatedItem().getDelegate().getParameterTypes().length == 0;
assert constructor.getParameters().size() == 0;
@@ -184,7 +184,7 @@
@Test @SpecAssertion(section="3.2.5.1")
public void testInitializerAnnotatedConstructorUsedOverEmptyConstuctor()
{
- SimpleConstructor<Turkey> constructor = new SimpleBeanModel<Turkey>(new SimpleAnnotatedType<Turkey>(Turkey.class), getEmptyAnnotatedType(Turkey.class), manager).getConstructor();
+ SimpleConstructor<Turkey> constructor = new SimpleBeanModel<Turkey>(new SimpleAnnotatedClass<Turkey>(Turkey.class), getEmptyAnnotatedType(Turkey.class), manager).getConstructor();
assert constructor.getParameters().size() == 2;
Iterator<InjectableParameter<?>> it = constructor.getParameters().iterator();
assert it.next().getType().equals(String.class);
@@ -194,25 +194,25 @@
@Test(expectedExceptions=DefinitionException.class) @SpecAssertion(section="3.2.5.1")
public void testTooManyInitializerAnnotatedConstructor()
{
- new SimpleBeanModel<Chicken>(new SimpleAnnotatedType<Chicken>(Chicken.class), getEmptyAnnotatedType(Chicken.class), manager);
+ new SimpleBeanModel<Chicken>(new SimpleAnnotatedClass<Chicken>(Chicken.class), getEmptyAnnotatedType(Chicken.class), manager);
}
@Test(expectedExceptions=DefinitionException.class, groups="disposalMethod") @SpecAssertion(section="3.2.5.1")
public void testConstructorHasDisposesParameter()
{
- new SimpleBeanModel<Chicken>(new SimpleAnnotatedType<Chicken>(Chicken.class), getEmptyAnnotatedType(Chicken.class), manager);
+ new SimpleBeanModel<Chicken>(new SimpleAnnotatedClass<Chicken>(Chicken.class), getEmptyAnnotatedType(Chicken.class), manager);
}
@Test(expectedExceptions=DefinitionException.class, groups="observerMethod") @SpecAssertion(section="3.2.5.1")
public void testConstructorHasObservesParameter()
{
- new SimpleBeanModel<Chicken>(new SimpleAnnotatedType<Chicken>(Chicken.class), getEmptyAnnotatedType(Chicken.class), manager);
+ new SimpleBeanModel<Chicken>(new SimpleAnnotatedClass<Chicken>(Chicken.class), getEmptyAnnotatedType(Chicken.class), manager);
}
@Test(groups="webbeansxml") @SpecAssertion(section="3.2.5.2")
public void testImplicitConstructorDeclaredInXmlUsed()
{
- SimpleConstructor<Order> constructor = new SimpleBeanModel<Order>(new SimpleAnnotatedType<Order>(Order.class), getEmptyAnnotatedType(Order.class), manager).getConstructor();
+ SimpleConstructor<Order> constructor = new SimpleBeanModel<Order>(new SimpleAnnotatedClass<Order>(Order.class), getEmptyAnnotatedType(Order.class), manager).getConstructor();
assert constructor.getAnnotatedItem().getDelegate().getDeclaringClass().equals(Order.class);
assert constructor.getAnnotatedItem().getDelegate().getParameterTypes().length == 0;
assert constructor.getParameters().size() == 0;
@@ -222,7 +222,7 @@
@Test(groups="webbeansxml") @SpecAssertion(section="3.2.5.2")
public void testEmptyConstructorDeclaredInXmlUsed()
{
- SimpleConstructor<Donkey> constructor = new SimpleBeanModel<Donkey>(new SimpleAnnotatedType<Donkey>(Donkey.class), getEmptyAnnotatedType(Donkey.class), manager).getConstructor(); assert constructor.getAnnotatedItem().getDelegate().getDeclaringClass().equals(Order.class);
+ SimpleConstructor<Donkey> constructor = new SimpleBeanModel<Donkey>(new SimpleAnnotatedClass<Donkey>(Donkey.class), getEmptyAnnotatedType(Donkey.class), manager).getConstructor(); assert constructor.getAnnotatedItem().getDelegate().getDeclaringClass().equals(Order.class);
assert constructor.getAnnotatedItem().getDelegate().getParameterTypes().length == 0;
assert constructor.getParameters().size() == 0;
assert false;
@@ -243,7 +243,7 @@
@Test @SpecAssertion(section="3.2.5.3")
public void testBindingTypeAnnotatedConstructor()
{
- SimpleConstructor<Duck> constructor = new SimpleBeanModel<Duck>(new SimpleAnnotatedType<Duck>(Duck.class), getEmptyAnnotatedType(Duck.class), manager).getConstructor();
+ SimpleConstructor<Duck> constructor = new SimpleBeanModel<Duck>(new SimpleAnnotatedClass<Duck>(Duck.class), getEmptyAnnotatedType(Duck.class), manager).getConstructor();
assert constructor.getAnnotatedItem().getDelegate().getDeclaringClass().equals(Duck.class);
assert constructor.getParameters().size() == 2;
Iterator<InjectableParameter<?>> it = constructor.getParameters().iterator();
@@ -261,7 +261,7 @@
@Test(groups="specialization") @SpecAssertion(section="3.2.6")
public void testSpecializedClassInheritsBindingTypes()
{
- SimpleBeanModel<Tractor> bean = new SimpleBeanModel<Tractor>(new SimpleAnnotatedType<Tractor>(Tractor.class), getEmptyAnnotatedType(Tractor.class), manager);
+ SimpleBeanModel<Tractor> bean = new SimpleBeanModel<Tractor>(new SimpleAnnotatedClass<Tractor>(Tractor.class), getEmptyAnnotatedType(Tractor.class), manager);
assert bean.getBindingTypes().size()==2;
assert bean.getBindingTypes().contains( new AnnotationLiteral<Motorized>() {} );
assert bean.getBindingTypes().contains( new AnnotationLiteral<HeavyDuty>() {} );
@@ -270,7 +270,7 @@
@Test(groups="specialization") @SpecAssertion(section="3.2.6")
public void testSpecializedClassInheritsName()
{
- SimpleBeanModel<Tractor> bean = new SimpleBeanModel<Tractor>(new SimpleAnnotatedType<Tractor>(Tractor.class), getEmptyAnnotatedType(Tractor.class), manager);
+ SimpleBeanModel<Tractor> bean = new SimpleBeanModel<Tractor>(new SimpleAnnotatedClass<Tractor>(Tractor.class), getEmptyAnnotatedType(Tractor.class), manager);
assert bean.getName()!=null;
assert bean.getName().equals("plough");
}
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypesTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypesTest.java 2008-11-05 12:27:30 UTC (rev 243)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/StereotypesTest.java 2008-11-05 13:02:04 UTC (rev 244)
@@ -11,8 +11,8 @@
import javax.webbeans.DefinitionException;
import javax.webbeans.RequestScoped;
-import org.jboss.webbeans.introspector.AnnotatedType;
-import org.jboss.webbeans.introspector.SimpleAnnotatedType;
+import org.jboss.webbeans.introspector.AnnotatedClass;
+import org.jboss.webbeans.introspector.SimpleAnnotatedClass;
import org.jboss.webbeans.model.StereotypeModel;
import org.jboss.webbeans.model.bean.SimpleBeanModel;
import org.jboss.webbeans.test.annotations.AnimalOrderStereotype;
@@ -153,7 +153,7 @@
@Test @SpecAssertion(section={"2.7.2", "2.7.4"})
public void testMultipleStereotypes()
{
- SimpleBeanModel<HighlandCow> highlandCow = new SimpleBeanModel<HighlandCow>(new SimpleAnnotatedType<HighlandCow>(HighlandCow.class), getEmptyAnnotatedType(HighlandCow.class), manager);
+ SimpleBeanModel<HighlandCow> highlandCow = new SimpleBeanModel<HighlandCow>(new SimpleAnnotatedClass<HighlandCow>(HighlandCow.class), getEmptyAnnotatedType(HighlandCow.class), manager);
assert highlandCow.getName() == null;
assert highlandCow.getBindingTypes().iterator().next().annotationType().equals(Tame.class);
assert highlandCow.getScopeType().equals(RequestScoped.class);
@@ -169,7 +169,7 @@
{
Map<Class<? extends Annotation>, Annotation> cooXmlAnnotations = new HashMap<Class<? extends Annotation>, Annotation>();
cooXmlAnnotations.put(HornedMammalStereotype.class, new HornedMamalStereotypeAnnotationLiteral());
- AnnotatedType<HighlandCow> cooXmlAnnotatedItem = new SimpleAnnotatedType<HighlandCow>(HighlandCow.class, cooXmlAnnotations);
+ AnnotatedClass<HighlandCow> cooXmlAnnotatedItem = new SimpleAnnotatedClass<HighlandCow>(HighlandCow.class, cooXmlAnnotations);
SimpleBeanModel<HighlandCow> coo = createSimpleModel(HighlandCow.class, cooXmlAnnotatedItem, manager);
assert coo.getDeploymentType().equals(HornedAnimalDeploymentType.class);
@@ -185,7 +185,7 @@
Map<Class<? extends Annotation>, Annotation> cooXmlAnnotations = new HashMap<Class<? extends Annotation>, Annotation>();
cooXmlAnnotations.put(HornedMammalStereotype.class, new HornedMamalStereotypeAnnotationLiteral());
cooXmlAnnotations.put(Synchronous.class, new SynchronousAnnotationLiteral());
- AnnotatedType<HighlandCow> cooXmlAnnotatedItem = new SimpleAnnotatedType<HighlandCow>(HighlandCow.class, cooXmlAnnotations);
+ AnnotatedClass<HighlandCow> cooXmlAnnotatedItem = new SimpleAnnotatedClass<HighlandCow>(HighlandCow.class, cooXmlAnnotations);
SimpleBeanModel<HighlandCow> coo = createSimpleModel(HighlandCow.class, cooXmlAnnotatedItem, manager);
assert coo.getBindingTypes().size() == 1;
@@ -196,25 +196,25 @@
@Test at SpecAssertion(section="2.7.4")
public void testRequiredTypeIsImplemented()
{
- new SimpleBeanModel<HighlandCow>(new SimpleAnnotatedType<HighlandCow>(HighlandCow.class), getEmptyAnnotatedType(HighlandCow.class), manager);
+ new SimpleBeanModel<HighlandCow>(new SimpleAnnotatedClass<HighlandCow>(HighlandCow.class), getEmptyAnnotatedType(HighlandCow.class), manager);
}
@Test(expectedExceptions=DefinitionException.class) @SpecAssertion(section="2.7.4")
public void testRequiredTypeIsNotImplemented()
{
- new SimpleBeanModel<Chair>(new SimpleAnnotatedType<Chair>(Chair.class), getEmptyAnnotatedType(Chair.class), manager);
+ new SimpleBeanModel<Chair>(new SimpleAnnotatedClass<Chair>(Chair.class), getEmptyAnnotatedType(Chair.class), manager);
}
@Test @SpecAssertion(section="2.7.4")
public void testScopeIsSupported()
{
- new SimpleBeanModel<Goldfish>(new SimpleAnnotatedType<Goldfish>(Goldfish.class), getEmptyAnnotatedType(Goldfish.class), manager);
+ new SimpleBeanModel<Goldfish>(new SimpleAnnotatedClass<Goldfish>(Goldfish.class), getEmptyAnnotatedType(Goldfish.class), manager);
}
@Test(expectedExceptions=DefinitionException.class) @SpecAssertion(section="2.7.4")
public void testScopeIsNotSupported()
{
- new SimpleBeanModel<Carp>(new SimpleAnnotatedType<Carp>(Carp.class), getEmptyAnnotatedType(Carp.class), manager);
+ new SimpleBeanModel<Carp>(new SimpleAnnotatedClass<Carp>(Carp.class), getEmptyAnnotatedType(Carp.class), manager);
}
}
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/TypeTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/TypeTest.java 2008-11-05 12:27:30 UTC (rev 243)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/TypeTest.java 2008-11-05 13:02:04 UTC (rev 244)
@@ -2,7 +2,7 @@
import static org.jboss.webbeans.test.util.Util.getEmptyAnnotatedType;
-import org.jboss.webbeans.introspector.SimpleAnnotatedType;
+import org.jboss.webbeans.introspector.SimpleAnnotatedClass;
import org.jboss.webbeans.model.bean.SimpleBeanModel;
import org.jboss.webbeans.test.beans.Haddock;
import org.testng.annotations.Test;
@@ -13,7 +13,7 @@
@Test @SpecAssertion(section="2.6.3")
public void testDefaultNamed()
{
- SimpleBeanModel<Haddock> haddock = new SimpleBeanModel<Haddock>(new SimpleAnnotatedType<Haddock>(Haddock.class), getEmptyAnnotatedType(Haddock.class), manager);
+ SimpleBeanModel<Haddock> haddock = new SimpleBeanModel<Haddock>(new SimpleAnnotatedClass<Haddock>(Haddock.class), getEmptyAnnotatedType(Haddock.class), manager);
assert haddock.getName() != null;
assert haddock.getName().equals("haddock");
}
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/util/Util.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/util/Util.java 2008-11-05 12:27:30 UTC (rev 243)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/util/Util.java 2008-11-05 13:02:04 UTC (rev 244)
@@ -5,8 +5,8 @@
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.SimpleBeanImpl;
-import org.jboss.webbeans.introspector.AnnotatedType;
-import org.jboss.webbeans.introspector.SimpleAnnotatedType;
+import org.jboss.webbeans.introspector.AnnotatedClass;
+import org.jboss.webbeans.introspector.SimpleAnnotatedClass;
import org.jboss.webbeans.model.bean.EnterpriseBeanModel;
import org.jboss.webbeans.model.bean.SimpleBeanModel;
@@ -19,27 +19,27 @@
public static <T> SimpleBeanModel<T> createSimpleModel(Class<T> clazz, ManagerImpl manager)
{
- return new SimpleBeanModel<T>(new SimpleAnnotatedType<T>(clazz), getEmptyAnnotatedType(clazz), manager);
+ return new SimpleBeanModel<T>(new SimpleAnnotatedClass<T>(clazz), getEmptyAnnotatedType(clazz), manager);
}
- public static <T> SimpleBeanModel<T> createSimpleModel(Class<T> clazz, AnnotatedType<T> xmlAnnotatedType, ManagerImpl manager)
+ public static <T> SimpleBeanModel<T> createSimpleModel(Class<T> clazz, AnnotatedClass<T> xmlAnnotatedType, ManagerImpl manager)
{
- return new SimpleBeanModel<T>(new SimpleAnnotatedType<T>(clazz), xmlAnnotatedType, manager);
+ return new SimpleBeanModel<T>(new SimpleAnnotatedClass<T>(clazz), xmlAnnotatedType, manager);
}
public static <T> EnterpriseBeanModel<T> createEnterpriseBeanModel(Class<T> clazz, ManagerImpl manager)
{
- return new EnterpriseBeanModel<T>(new SimpleAnnotatedType<T>(clazz), getEmptyAnnotatedType(clazz), manager);
+ return new EnterpriseBeanModel<T>(new SimpleAnnotatedClass<T>(clazz), getEmptyAnnotatedType(clazz), manager);
}
- public static <T> EnterpriseBeanModel<T> createEnterpriseBeanModel(Class<T> clazz, AnnotatedType<T> xmlAnnotatedType, ManagerImpl manager)
+ public static <T> EnterpriseBeanModel<T> createEnterpriseBeanModel(Class<T> clazz, AnnotatedClass<T> xmlAnnotatedType, ManagerImpl manager)
{
- return new EnterpriseBeanModel<T>(new SimpleAnnotatedType<T>(clazz), xmlAnnotatedType, manager);
+ return new EnterpriseBeanModel<T>(new SimpleAnnotatedClass<T>(clazz), xmlAnnotatedType, manager);
}
- public static <T> AnnotatedType<T> getEmptyAnnotatedType(Class<T> type)
+ public static <T> AnnotatedClass<T> getEmptyAnnotatedType(Class<T> type)
{
- return new SimpleAnnotatedType<T>(type, new HashMap<Class<? extends Annotation>, Annotation>());
+ return new SimpleAnnotatedClass<T>(type, new HashMap<Class<? extends Annotation>, Annotation>());
}
More information about the weld-commits
mailing list