[webbeans-commits] Webbeans SVN: r298 - in ri/trunk/webbeans-ri/src: main/java/org/jboss/webbeans/bean and 5 other directories.
webbeans-commits at lists.jboss.org
webbeans-commits at lists.jboss.org
Thu Nov 13 04:55:06 EST 2008
Author: pete.muir at jboss.org
Date: 2008-11-13 04:55:06 -0500 (Thu, 13 Nov 2008)
New Revision: 298
Added:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedAnnotationImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedFieldImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedItemImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedParameterImpl.java
Removed:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/SimpleAnnotatedAnnotation.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/SimpleAnnotatedClass.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/SimpleAnnotatedConstructor.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/SimpleAnnotatedField.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/SimpleAnnotatedItem.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/SimpleAnnotatedMethod.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/SimpleAnnotatedParameter.java
Modified:
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EventBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ejb/EjbMetaData.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedMember.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedType.java
ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AnnotationModel.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/InstantiationByNameTest.java
ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InstantiationByTypeTest.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/ResolutionByTypeTest.java
Log:
Rename some stuff
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java 2008-11-13 09:42:14 UTC (rev 297)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ManagerImpl.java 2008-11-13 09:55:06 UTC (rev 298)
@@ -40,7 +40,7 @@
import org.jboss.webbeans.exceptions.NameResolutionLocation;
import org.jboss.webbeans.introspector.AnnotatedItem;
import org.jboss.webbeans.introspector.AnnotatedMethod;
-import org.jboss.webbeans.introspector.impl.SimpleAnnotatedClass;
+import org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl;
import org.jboss.webbeans.util.Reflections;
import com.google.common.collect.ForwardingMap;
@@ -176,12 +176,12 @@
public <T> Set<Bean<T>> resolveByType(Class<T> type, Annotation... bindingTypes)
{
- return resolveByType(new SimpleAnnotatedClass<T>(type, type, bindingTypes), bindingTypes);
+ return resolveByType(new AnnotatedClassImpl<T>(type, type, bindingTypes), bindingTypes);
}
public <T> Set<Bean<T>> resolveByType(TypeLiteral<T> type, Annotation... bindingTypes)
{
- return resolveByType(new SimpleAnnotatedClass<T>(type.getRawType(), type.getType(), bindingTypes), bindingTypes);
+ return resolveByType(new AnnotatedClassImpl<T>(type.getRawType(), type.getType(), bindingTypes), bindingTypes);
}
public <T> Set<Bean<T>> resolveByType(AnnotatedItem<T, ?> element, Annotation... bindingTypes)
@@ -345,12 +345,12 @@
public <T> T getInstanceByType(Class<T> type, Annotation... bindingTypes)
{
- return getInstanceByType(new SimpleAnnotatedClass<T>(type, type, bindingTypes), bindingTypes);
+ return getInstanceByType(new AnnotatedClassImpl<T>(type, type, bindingTypes), bindingTypes);
}
public <T> T getInstanceByType(TypeLiteral<T> type, Annotation... bindingTypes)
{
- return getInstanceByType(new SimpleAnnotatedClass<T>(type.getRawType(), type.getType(), bindingTypes), bindingTypes);
+ return getInstanceByType(new AnnotatedClassImpl<T>(type.getRawType(), type.getType(), bindingTypes), bindingTypes);
}
public <T> T getInstanceByType(AnnotatedItem<T, ?> element, Annotation... bindingTypes)
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java 2008-11-13 09:42:14 UTC (rev 297)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/AbstractClassBean.java 2008-11-13 09:55:06 UTC (rev 298)
@@ -15,7 +15,7 @@
import org.jboss.webbeans.introspector.AnnotatedClass;
import org.jboss.webbeans.introspector.AnnotatedField;
import org.jboss.webbeans.introspector.AnnotatedMethod;
-import org.jboss.webbeans.introspector.impl.SimpleAnnotatedClass;
+import org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
import org.jboss.webbeans.util.Reflections;
@@ -39,7 +39,7 @@
public AbstractClassBean(Class<T> type, ManagerImpl manager)
{
super(manager);
- this.annotatedItem = new SimpleAnnotatedClass<T>(type);
+ this.annotatedItem = new AnnotatedClassImpl<T>(type);
}
@Override
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EventBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EventBean.java 2008-11-13 09:42:14 UTC (rev 297)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/EventBean.java 2008-11-13 09:55:06 UTC (rev 298)
@@ -9,7 +9,7 @@
import org.jboss.webbeans.event.EventImpl;
import org.jboss.webbeans.introspector.AnnotatedField;
import org.jboss.webbeans.introspector.AnnotatedItem;
-import org.jboss.webbeans.introspector.impl.SimpleAnnotatedField;
+import org.jboss.webbeans.introspector.jlr.AnnotatedFieldImpl;
import org.jboss.webbeans.log.LogProvider;
import org.jboss.webbeans.log.Logging;
@@ -24,7 +24,7 @@
public EventBean(Field field, ManagerImpl manager, AbstractClassBean<?> declaringBean)
{
super(manager);
- this.annotatedItem = new SimpleAnnotatedField<EventImpl<T>>(field, declaringBean.getAnnotatedItem());
+ this.annotatedItem = new AnnotatedFieldImpl<EventImpl<T>>(field, declaringBean.getAnnotatedItem());
init();
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java 2008-11-13 09:42:14 UTC (rev 297)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/bean/ProducerMethodBean.java 2008-11-13 09:55:06 UTC (rev 298)
@@ -16,7 +16,7 @@
import org.jboss.webbeans.ManagerImpl;
import org.jboss.webbeans.introspector.AnnotatedMethod;
import org.jboss.webbeans.introspector.AnnotatedParameter;
-import org.jboss.webbeans.introspector.impl.SimpleAnnotatedMethod;
+import org.jboss.webbeans.introspector.jlr.AnnotatedMethodImpl;
public class ProducerMethodBean<T> extends AbstractBean<T, Method>
{
@@ -30,7 +30,7 @@
public ProducerMethodBean(Method method, AbstractClassBean<?> declaringBean, ManagerImpl manager)
{
super(manager);
- this.method = new SimpleAnnotatedMethod<T>(method, declaringBean.getAnnotatedItem());
+ this.method = new AnnotatedMethodImpl<T>(method, declaringBean.getAnnotatedItem());
this.declaringBean = declaringBean;
init();
}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ejb/EjbMetaData.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ejb/EjbMetaData.java 2008-11-13 09:42:14 UTC (rev 297)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/ejb/EjbMetaData.java 2008-11-13 09:55:06 UTC (rev 298)
@@ -18,7 +18,7 @@
import org.jboss.webbeans.introspector.AnnotatedClass;
import org.jboss.webbeans.introspector.AnnotatedMethod;
-import org.jboss.webbeans.introspector.impl.SimpleAnnotatedClass;
+import org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl;
public class EjbMetaData<T>
{
@@ -50,7 +50,7 @@
public EjbMetaData(Class<T> type)
{
- this(new SimpleAnnotatedClass<T>(type));
+ this(new AnnotatedClassImpl<T>(type));
}
public EjbMetaData(AnnotatedClass<T> type)
Copied: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr (from rev 297, ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl)
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/AbstractAnnotatedItem.java 2008-11-13 09:42:14 UTC (rev 297)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java 2008-11-13 09:55:06 UTC (rev 298)
@@ -1,4 +1,4 @@
-package org.jboss.webbeans.introspector.impl;
+package org.jboss.webbeans.introspector.jlr;
import java.lang.annotation.Annotation;
import java.lang.reflect.AnnotatedElement;
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedMember.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/AbstractAnnotatedMember.java 2008-11-13 09:42:14 UTC (rev 297)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedMember.java 2008-11-13 09:55:06 UTC (rev 298)
@@ -1,4 +1,4 @@
-package org.jboss.webbeans.introspector.impl;
+package org.jboss.webbeans.introspector.jlr;
import java.lang.annotation.Annotation;
import java.lang.reflect.Member;
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedType.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/AbstractAnnotatedType.java 2008-11-13 09:42:14 UTC (rev 297)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedType.java 2008-11-13 09:55:06 UTC (rev 298)
@@ -1,4 +1,4 @@
-package org.jboss.webbeans.introspector.impl;
+package org.jboss.webbeans.introspector.jlr;
import java.lang.annotation.Annotation;
import java.util.Map;
@@ -37,7 +37,7 @@
{
if (superclass == null)
{
- superclass = new SimpleAnnotatedClass(getDelegate().getSuperclass());
+ superclass = new AnnotatedClassImpl(getDelegate().getSuperclass());
}
return superclass;
}
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedAnnotationImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedAnnotationImpl.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedAnnotationImpl.java 2008-11-13 09:55:06 UTC (rev 298)
@@ -0,0 +1,99 @@
+package org.jboss.webbeans.introspector.jlr;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.webbeans.introspector.AnnotatedAnnotation;
+import org.jboss.webbeans.introspector.AnnotatedMethod;
+
+public class AnnotatedAnnotationImpl<T extends Annotation> extends AbstractAnnotatedType<T> implements AnnotatedAnnotation<T>
+{
+
+ private Map<Class<? extends Annotation>, Set<AnnotatedMethod<?>>> annotatedMembers;
+
+ private Class<T> clazz;
+
+ private Set<AnnotatedMethod<?>> members;
+
+ public AnnotatedAnnotationImpl(Class<T> annotationType)
+ {
+ super(buildAnnotationMap(annotationType));
+ this.clazz = annotationType;
+ }
+
+ public Type[] getActualTypeArguments()
+ {
+ return new Type[0];
+ }
+
+ public Set<AnnotatedMethod<?>> getMembers()
+ {
+ if (members == null)
+ {
+ initMembers();
+ }
+ return members;
+ }
+
+ public Class<T> getDelegate()
+ {
+ return clazz;
+ }
+
+ public Class<T> getType()
+ {
+ return clazz;
+ }
+
+ private void initMembers()
+ {
+ this.members = new HashSet<AnnotatedMethod<?>>();
+ for (Method member : clazz.getDeclaredMethods())
+ {
+ members.add(new AnnotatedMethodImpl<Object>(member, this));
+ }
+ }
+
+ public Set<AnnotatedMethod<?>> getAnnotatedMembers(Class<? extends Annotation> annotationType)
+ {
+ if (annotatedMembers == null)
+ {
+ initAnnotatedMembers();
+ }
+
+ if (!annotatedMembers.containsKey(annotationType))
+ {
+ return new HashSet<AnnotatedMethod<?>>();
+ }
+ else
+ {
+ return annotatedMembers.get(annotationType);
+ }
+ }
+
+ private void initAnnotatedMembers()
+ {
+ if (members == null)
+ {
+ initMembers();
+ }
+ annotatedMembers = new HashMap<Class<? extends Annotation>, Set<AnnotatedMethod<?>>>();
+ for (AnnotatedMethod<?> member : members)
+ {
+ for (Annotation annotation : member.getAnnotations())
+ {
+ if (!annotatedMembers.containsKey(annotation))
+ {
+ annotatedMembers.put(annotation.annotationType(), new HashSet<AnnotatedMethod<?>>());
+ }
+ annotatedMembers.get(annotation.annotationType()).add(member);
+ }
+ }
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedAnnotationImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java 2008-11-13 09:55:06 UTC (rev 298)
@@ -0,0 +1,284 @@
+package org.jboss.webbeans.introspector.jlr;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.jboss.webbeans.introspector.AnnotatedClass;
+import org.jboss.webbeans.introspector.AnnotatedConstructor;
+import org.jboss.webbeans.introspector.AnnotatedField;
+import org.jboss.webbeans.introspector.AnnotatedMethod;
+
+/**
+ * Base class for implementing AnnotatedItem.
+ *
+ * @author pmuir
+ *
+ */
+public class AnnotatedClassImpl<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;
+
+ private Set<AnnotatedConstructor<T>> constructors;
+ private Map<Class<? extends Annotation>, Set<AnnotatedConstructor<T>>> annotatedConstructors;
+ private Map<List<Class<?>>, AnnotatedConstructor<T>> constructorsByArgumentMap;
+
+ public AnnotatedClassImpl(Class<T> rawType, Type type, Annotation[] annotations)
+ {
+ super(buildAnnotationMap(annotations));
+ this.clazz = rawType;
+ if (type instanceof ParameterizedType)
+ {
+ actualTypeArguments = ((ParameterizedType) type).getActualTypeArguments();
+ }
+ else
+ {
+ actualTypeArguments = new Type[0];
+ }
+ }
+
+ public AnnotatedClassImpl(Class<T> clazz)
+ {
+ this(clazz, clazz, clazz.getAnnotations());
+ }
+
+ public Class<? extends T> getAnnotatedClass()
+ {
+ return clazz;
+ }
+
+ public Class<T> getDelegate()
+ {
+ return clazz;
+ }
+
+ public Set<AnnotatedField<Object>> getFields()
+ {
+ if (fields == null)
+ {
+ initFields();
+ }
+ return fields;
+ }
+
+ public Set<AnnotatedConstructor<T>> getConstructors()
+ {
+ if (constructors == null)
+ {
+ initConstructors();
+ }
+ return constructors;
+ }
+
+ private void initFields()
+ {
+ this.fields = new HashSet<AnnotatedField<Object>>();
+ for(Class c=clazz;c!=Object.class;c=c.getSuperclass())
+ {
+ for(Field field : clazz.getDeclaredFields())
+ {
+ if ( !field.isAccessible() ) field.setAccessible(true);
+ fields.add(new AnnotatedFieldImpl<Object>(field, this));
+ }
+ }
+ }
+
+ 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(Class c=clazz;c!=Object.class;c=c.getSuperclass())
+ {
+ for (Method method : clazz.getDeclaredMethods())
+ {
+ if (!method.isAccessible()) method.setAccessible(true);
+ methods.add(new AnnotatedMethodImpl<Object>(method, this));
+ }
+ }
+ }
+
+ 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.annotationType()))
+ {
+ annotatedMethods.put(annotation.annotationType(), new HashSet<AnnotatedMethod<Object>>());
+ }
+ annotatedMethods.get(annotation.annotationType()).add(member);
+ }
+ }
+ }
+
+ private void initConstructors()
+ {
+ this.constructors = new HashSet<AnnotatedConstructor<T>>();
+ this.constructorsByArgumentMap = new HashMap<List<Class<?>>, AnnotatedConstructor<T>>();
+ for (Constructor<T> constructor : clazz.getDeclaredConstructors())
+ {
+ AnnotatedConstructor<T> annotatedConstructor = new AnnotatedConstructorImpl<T>(constructor, this);
+ if (!constructor.isAccessible()) constructor.setAccessible(true);
+ constructors.add(annotatedConstructor);
+ constructorsByArgumentMap.put(Arrays.asList(constructor.getParameterTypes()), annotatedConstructor);
+ }
+ }
+
+ public Set<AnnotatedConstructor<T>> getAnnotatedConstructors(Class<? extends Annotation> annotationType)
+ {
+ if (annotatedConstructors == null)
+ {
+ initAnnotatedConstructors();
+ }
+
+ if (!annotatedConstructors.containsKey(annotationType))
+ {
+ return new HashSet<AnnotatedConstructor<T>>();
+ }
+ else
+ {
+ return annotatedConstructors.get(annotationType);
+ }
+ }
+
+ private void initAnnotatedConstructors()
+ {
+ if (constructors == null)
+ {
+ initConstructors();
+ }
+ annotatedConstructors = new HashMap<Class<? extends Annotation>, Set<AnnotatedConstructor<T>>>();
+ for (AnnotatedConstructor<T> constructor : constructors)
+ {
+ for (Annotation annotation : constructor.getAnnotations())
+ {
+ if (!annotatedConstructors.containsKey(annotation.annotationType()))
+ {
+ annotatedConstructors.put(annotation.annotationType(), new HashSet<AnnotatedConstructor<T>>());
+ }
+ annotatedConstructors.get(annotation.annotationType()).add(constructor);
+ }
+ }
+ }
+
+ public AnnotatedConstructor<T> getConstructor(List<Class<?>> arguments)
+ {
+ return constructorsByArgumentMap.get(arguments);
+ }
+
+}
\ No newline at end of file
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java 2008-11-13 09:55:06 UTC (rev 298)
@@ -0,0 +1,184 @@
+package org.jboss.webbeans.introspector.jlr;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.webbeans.ExecutionException;
+
+import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.introspector.AnnotatedConstructor;
+import org.jboss.webbeans.introspector.AnnotatedParameter;
+import org.jboss.webbeans.introspector.AnnotatedType;
+
+public class AnnotatedConstructorImpl<T> extends AbstractAnnotatedMember<T, Constructor<T>> implements AnnotatedConstructor<T>
+{
+
+ private static final Type[] actualTypeArguments = new Type[0];
+
+ private Constructor<T> constructor;
+
+ private List<AnnotatedParameter<Object>> parameters;
+ private Map<Class<? extends Annotation>, List<AnnotatedParameter<Object>>> annotatedParameters;
+
+ private AnnotatedType<T> declaringClass;
+
+ public AnnotatedConstructorImpl(Constructor<T> constructor, AnnotatedType<T> declaringClass)
+ {
+ super(buildAnnotationMap(constructor));
+ this.constructor = constructor;
+ this.declaringClass = declaringClass;
+ }
+
+ public Constructor<T> getAnnotatedConstructor()
+ {
+ return constructor;
+ }
+
+ public Constructor<T> getDelegate()
+ {
+ return constructor;
+ }
+
+ public Class<T> getType()
+ {
+ return constructor.getDeclaringClass();
+ }
+
+ public Type[] getActualTypeArguments()
+ {
+ return actualTypeArguments;
+ }
+
+ public List<AnnotatedParameter<Object>> getParameters()
+ {
+ if (parameters == null)
+ {
+ initParameters();
+ }
+ return parameters;
+ }
+
+ private void initParameters()
+ {
+ this.parameters = new ArrayList<AnnotatedParameter<Object>>();
+ for (int i = 0; i < constructor.getParameterTypes().length; i++)
+ {
+ if (constructor.getParameterAnnotations()[i].length > 0)
+ {
+ Class<? extends Object> clazz = constructor.getParameterTypes()[i];
+ AnnotatedParameter<Object> parameter = new AnnotatedParameterImpl<Object>(constructor.getParameterAnnotations()[i], (Class<Object>) clazz);
+ parameters.add(parameter);
+ }
+ else
+ {
+ Class<? extends Object> clazz = constructor.getParameterTypes()[i];
+ AnnotatedParameter<Object> parameter = new AnnotatedParameterImpl<Object>(new Annotation[0], (Class<Object>) clazz);
+ parameters.add(parameter);
+ }
+ }
+ }
+
+ public List<AnnotatedParameter<Object>> getAnnotatedMethods(Class<? extends Annotation> annotationType)
+ {
+ if (annotatedParameters == null)
+ {
+ initAnnotatedParameters();
+ }
+
+ if (!annotatedParameters.containsKey(annotationType))
+ {
+ return new ArrayList<AnnotatedParameter<Object>>();
+ }
+ else
+ {
+ return annotatedParameters.get(annotationType);
+ }
+ }
+
+ private void initAnnotatedParameters()
+ {
+ if (parameters == null)
+ {
+ initParameters();
+ }
+ annotatedParameters = new HashMap<Class<? extends Annotation>, List<AnnotatedParameter<Object>>>();
+ for (AnnotatedParameter<Object> parameter : parameters)
+ {
+ for (Annotation annotation : parameter.getAnnotations())
+ {
+ if (!annotatedParameters.containsKey(annotation))
+ {
+ annotatedParameters.put(annotation.annotationType(), new ArrayList<AnnotatedParameter<Object>>());
+ }
+ annotatedParameters.get(annotation.annotationType()).add(parameter);
+ }
+ }
+ }
+
+ public List<AnnotatedParameter<Object>> getAnnotatedParameters(Class<? extends Annotation> annotationType)
+ {
+ if (annotatedParameters == null)
+ {
+ initAnnotatedParameters();
+ }
+ if (!annotatedParameters.containsKey(annotationType))
+ {
+ return new ArrayList<AnnotatedParameter<Object>>();
+ }
+ return annotatedParameters.get(annotationType);
+ }
+
+ public T newInstance(ManagerImpl manager)
+ {
+ try
+ {
+ return getDelegate().newInstance(getParameterValues(parameters, manager));
+ }
+ catch (IllegalArgumentException e)
+ {
+ throw new ExecutionException(e);
+ }
+ catch (InstantiationException e)
+ {
+ throw new ExecutionException(e);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new ExecutionException(e);
+ }
+ catch (InvocationTargetException e)
+ {
+ throw new ExecutionException(e);
+ }
+ }
+
+ @Override
+ public boolean equals(Object other)
+ {
+
+ if (super.equals(other) && other instanceof AnnotatedConstructor)
+ {
+ AnnotatedConstructor<?> that = (AnnotatedConstructor<?>) other;
+ return this.getDelegate().equals(that.getDelegate());
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return getDelegate().hashCode();
+ }
+
+ public AnnotatedType<T> getDeclaringClass()
+ {
+ return declaringClass;
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedFieldImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedFieldImpl.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedFieldImpl.java 2008-11-13 09:55:06 UTC (rev 298)
@@ -0,0 +1,67 @@
+package org.jboss.webbeans.introspector.jlr;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+
+import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.introspector.AnnotatedField;
+import org.jboss.webbeans.introspector.AnnotatedType;
+import org.jboss.webbeans.util.Reflections;
+
+public class AnnotatedFieldImpl<T> extends AbstractAnnotatedMember<T, Field> implements AnnotatedField<T>
+{
+
+ private Type[] actualTypeArguments = new Type[0];
+
+ private Field field;
+ private AnnotatedType<?> declaringClass;
+
+ public AnnotatedFieldImpl(Field field, AnnotatedType<?> declaringClass)
+ {
+ super(buildAnnotationMap(field));
+ this.field = field;
+ this.declaringClass = declaringClass;
+ if (field.getGenericType() instanceof ParameterizedType)
+ {
+ ParameterizedType type = (ParameterizedType) field.getGenericType();
+ actualTypeArguments = type.getActualTypeArguments();
+ }
+ }
+
+ public Field getAnnotatedField()
+ {
+ return field;
+ }
+
+ public Field getDelegate()
+ {
+ return field;
+ }
+
+ public Class<T> getType()
+ {
+ return (Class<T>) field.getType();
+ }
+
+ public Type[] getActualTypeArguments()
+ {
+ return actualTypeArguments;
+ }
+
+ public void inject(Object instance, ManagerImpl manager)
+ {
+ Reflections.setAndWrap(getDelegate(), instance, getValue(manager));
+ }
+
+ public String getPropertyName()
+ {
+ return getName();
+ }
+
+ public AnnotatedType<?> getDeclaringClass()
+ {
+ return declaringClass;
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedFieldImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedItemImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedItemImpl.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedItemImpl.java 2008-11-13 09:55:06 UTC (rev 298)
@@ -0,0 +1,103 @@
+package org.jboss.webbeans.introspector.jlr;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.Map;
+
+import javax.webbeans.TypeLiteral;
+
+public class AnnotatedItemImpl<T, S> extends AbstractAnnotatedItem<T, S>
+{
+
+ private Type[] actualTypeArguments = new Type[0];
+ private Class<T> type;
+ private Annotation[] actualAnnotations;
+
+ private AnnotatedItemImpl(Map<Class<? extends Annotation>, Annotation> annotationMap)
+ {
+ super(annotationMap);
+ }
+
+ private AnnotatedItemImpl(Map<Class<? extends Annotation>, Annotation> annotationMap, Class<T> type)
+ {
+ super(annotationMap);
+ this.type = type;
+ }
+
+ private AnnotatedItemImpl(Map<Class<? extends Annotation>, Annotation> annotationMap, TypeLiteral<T> apiType)
+ {
+ super(annotationMap);
+ this.type = apiType.getRawType();
+ if (apiType.getType() instanceof ParameterizedType)
+ {
+ actualTypeArguments = ((ParameterizedType) apiType.getType()).getActualTypeArguments();
+ }
+ }
+
+ private AnnotatedItemImpl(Map<Class<? extends Annotation>, Annotation> annotationMap, Class<T> type, Type[] actualTypeArguments)
+ {
+ this(annotationMap, type);
+ this.actualTypeArguments = actualTypeArguments;
+ }
+
+ public AnnotatedItemImpl(Annotation[] annotations)
+ {
+ this(buildAnnotationMap(annotations));
+ this.actualAnnotations = annotations;
+ }
+
+ public AnnotatedItemImpl(Annotation[] annotations, Class<T> type)
+ {
+ this(buildAnnotationMap(annotations), type);
+ this.actualAnnotations = annotations;
+ }
+
+ public AnnotatedItemImpl(Annotation[] annotations, TypeLiteral<T> apiType)
+ {
+ this(buildAnnotationMap(annotations), apiType);
+ this.actualAnnotations = annotations;
+ }
+
+ public AnnotatedItemImpl(Annotation[] annotations, Class<T> type, Type[] actualTypeArguments)
+ {
+ this(buildAnnotationMap(annotations), type, actualTypeArguments);
+ this.actualAnnotations = annotations;
+ }
+
+ public S getDelegate()
+ {
+ return null;
+ }
+
+ public Class<T> getType()
+ {
+ return type;
+ }
+
+ public Type[] getActualTypeArguments()
+ {
+ return actualTypeArguments;
+ }
+
+ public Annotation[] getActualAnnotations()
+ {
+ return actualAnnotations;
+ }
+
+ public boolean isStatic()
+ {
+ return false;
+ }
+
+ public boolean isFinal()
+ {
+ return false;
+ }
+
+ public String getName()
+ {
+ throw new IllegalArgumentException("Unable to determine name");
+ }
+
+}
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java 2008-11-13 09:55:06 UTC (rev 298)
@@ -0,0 +1,190 @@
+package org.jboss.webbeans.introspector.jlr;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.introspector.AnnotatedMethod;
+import org.jboss.webbeans.introspector.AnnotatedParameter;
+import org.jboss.webbeans.introspector.AnnotatedType;
+import org.jboss.webbeans.util.Reflections;
+
+public class AnnotatedMethodImpl<T> extends AbstractAnnotatedMember<T, Method> implements AnnotatedMethod<T>
+{
+
+ private Type[] actualTypeArgements = new Type[0];
+
+ private Method method;
+
+ private List<AnnotatedParameter<Object>> parameters;
+ private Map<Class<? extends Annotation>, List<AnnotatedParameter<Object>>> annotatedParameters;
+
+ private String propertyName;
+
+ private AnnotatedType<?> declaringClass;
+
+ public AnnotatedMethodImpl(Method method, AnnotatedType<?> declaringClass)
+ {
+ super(buildAnnotationMap(method));
+ this.method = method;
+ this.declaringClass = declaringClass;
+ if (method.getGenericReturnType() instanceof ParameterizedType)
+ {
+ actualTypeArgements = ((ParameterizedType) method.getGenericReturnType()).getActualTypeArguments();
+ }
+ }
+
+ public Method getAnnotatedMethod()
+ {
+ return method;
+ }
+
+ public Method getDelegate()
+ {
+ return method;
+ }
+
+ public Class<T> getType()
+ {
+ return (Class<T>) method.getReturnType();
+ }
+
+ public Type[] getActualTypeArguments()
+ {
+ return actualTypeArgements;
+ }
+
+ public List<AnnotatedParameter<Object>> getParameters()
+ {
+ if (parameters == null)
+ {
+ initParameters();
+ }
+ return parameters;
+ }
+
+ private void initParameters()
+ {
+ this.parameters = new ArrayList<AnnotatedParameter<Object>>();
+ for (int i = 0; i < method.getParameterTypes().length; i++)
+ {
+ if (method.getParameterAnnotations()[i].length > 0)
+ {
+ Class<? extends Object> clazz = method.getParameterTypes()[i];
+ AnnotatedParameter<Object> parameter = new AnnotatedParameterImpl<Object>(method.getParameterAnnotations()[i], (Class<Object>) clazz);
+ parameters.add(parameter);
+ }
+ else
+ {
+ Class<? extends Object> clazz = method.getParameterTypes()[i];
+ AnnotatedParameter<Object> parameter = new AnnotatedParameterImpl<Object>(new Annotation[0], (Class<Object>) clazz);
+ parameters.add(parameter);
+ }
+ }
+ }
+
+ public List<AnnotatedParameter<Object>> getAnnotatedMethods(Class<? extends Annotation> annotationType)
+ {
+ if (annotatedParameters == null)
+ {
+ initAnnotatedParameters();
+ }
+
+ if (!annotatedParameters.containsKey(annotationType))
+ {
+ return new ArrayList<AnnotatedParameter<Object>>();
+ }
+ else
+ {
+ return annotatedParameters.get(annotationType);
+ }
+ }
+
+ private void initAnnotatedParameters()
+ {
+ if (parameters == null)
+ {
+ initParameters();
+ }
+ annotatedParameters = new HashMap<Class<? extends Annotation>, List<AnnotatedParameter<Object>>>();
+ for (AnnotatedParameter<Object> parameter : parameters)
+ {
+ for (Annotation annotation : parameter.getAnnotations())
+ {
+ if (!annotatedParameters.containsKey(annotation))
+ {
+ annotatedParameters.put(annotation.annotationType(), new ArrayList<AnnotatedParameter<Object>>());
+ }
+ annotatedParameters.get(annotation.annotationType()).add(parameter);
+ }
+ }
+ }
+
+ public List<AnnotatedParameter<Object>> getAnnotatedParameters(Class<? extends Annotation> annotationType)
+ {
+ if (annotatedParameters == null)
+ {
+ initAnnotatedParameters();
+ }
+ if (!annotatedParameters.containsKey(annotationType))
+ {
+ return new ArrayList<AnnotatedParameter<Object>>();
+ }
+ return annotatedParameters.get(annotationType);
+ }
+
+ @Override
+ public boolean equals(Object other)
+ {
+ if (other instanceof AnnotatedMethod)
+ {
+ AnnotatedMethod<?> that = (AnnotatedMethod<?>) other;
+ return this.getDelegate().equals(that.getDelegate());
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return getDelegate().hashCode();
+ }
+
+ public T invoke(ManagerImpl manager, Object instance)
+ {
+ return (T) Reflections.invokeAndWrap(getDelegate(), instance, getParameterValues(parameters, manager));
+ }
+
+ public T invoke(Object instance, Object... parameters)
+ {
+ return (T) Reflections.invokeAndWrap(getDelegate(), instance, parameters);
+ }
+
+ public String getPropertyName()
+ {
+ if (propertyName == null)
+ {
+ propertyName = Reflections.getPropertyName(getDelegate());
+ if (propertyName == null)
+ {
+ propertyName = getName();
+ }
+ }
+ return propertyName;
+ }
+
+ public AnnotatedType<?> getDeclaringClass()
+ {
+ return declaringClass;
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedParameterImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedParameterImpl.java (rev 0)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedParameterImpl.java 2008-11-13 09:55:06 UTC (rev 298)
@@ -0,0 +1,60 @@
+package org.jboss.webbeans.introspector.jlr;
+
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+
+import javax.webbeans.BindingType;
+
+import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.introspector.AnnotatedParameter;
+
+public class AnnotatedParameterImpl<T> extends AbstractAnnotatedItem<T, Object> implements AnnotatedParameter<T>
+{
+
+ private Class<T> type;
+ private Type[] actualTypeArguments = new Type[0];
+ private boolean _final;
+ private boolean _static;
+
+ public AnnotatedParameterImpl(Annotation[] annotations, Class<T> type)
+ {
+ super(buildAnnotationMap(annotations));
+ this.type = type;
+ }
+
+ public Type[] getActualTypeArguments()
+ {
+ return actualTypeArguments;
+ }
+
+ public Object getDelegate()
+ {
+ return null;
+ }
+
+ public Class<T> getType()
+ {
+ return type;
+ }
+
+ public boolean isFinal()
+ {
+ return _final;
+ }
+
+ public boolean isStatic()
+ {
+ return _static;
+ }
+
+ public T getValue(ManagerImpl manager)
+ {
+ return manager.getInstanceByType(getType(), getAnnotationsAsArray(BindingType.class));
+ }
+
+ public String getName()
+ {
+ throw new IllegalArgumentException("Unable to determine name of parameter");
+ }
+
+}
Property changes on: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedParameterImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/SimpleAnnotatedAnnotation.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/SimpleAnnotatedAnnotation.java 2008-11-13 09:42:14 UTC (rev 297)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/SimpleAnnotatedAnnotation.java 2008-11-13 09:55:06 UTC (rev 298)
@@ -1,99 +0,0 @@
-package org.jboss.webbeans.introspector.impl;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-import java.lang.reflect.Type;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.jboss.webbeans.introspector.AnnotatedAnnotation;
-import org.jboss.webbeans.introspector.AnnotatedMethod;
-
-public class SimpleAnnotatedAnnotation<T extends Annotation> extends AbstractAnnotatedType<T> implements AnnotatedAnnotation<T>
-{
-
- private Map<Class<? extends Annotation>, Set<AnnotatedMethod<?>>> annotatedMembers;
-
- private Class<T> clazz;
-
- private Set<AnnotatedMethod<?>> members;
-
- public SimpleAnnotatedAnnotation(Class<T> annotationType)
- {
- super(buildAnnotationMap(annotationType));
- this.clazz = annotationType;
- }
-
- public Type[] getActualTypeArguments()
- {
- return new Type[0];
- }
-
- public Set<AnnotatedMethod<?>> getMembers()
- {
- if (members == null)
- {
- initMembers();
- }
- return members;
- }
-
- public Class<T> getDelegate()
- {
- return clazz;
- }
-
- public Class<T> getType()
- {
- return clazz;
- }
-
- private void initMembers()
- {
- this.members = new HashSet<AnnotatedMethod<?>>();
- for (Method member : clazz.getDeclaredMethods())
- {
- members.add(new SimpleAnnotatedMethod<Object>(member, this));
- }
- }
-
- public Set<AnnotatedMethod<?>> getAnnotatedMembers(Class<? extends Annotation> annotationType)
- {
- if (annotatedMembers == null)
- {
- initAnnotatedMembers();
- }
-
- if (!annotatedMembers.containsKey(annotationType))
- {
- return new HashSet<AnnotatedMethod<?>>();
- }
- else
- {
- return annotatedMembers.get(annotationType);
- }
- }
-
- private void initAnnotatedMembers()
- {
- if (members == null)
- {
- initMembers();
- }
- annotatedMembers = new HashMap<Class<? extends Annotation>, Set<AnnotatedMethod<?>>>();
- for (AnnotatedMethod<?> member : members)
- {
- for (Annotation annotation : member.getAnnotations())
- {
- if (!annotatedMembers.containsKey(annotation))
- {
- annotatedMembers.put(annotation.annotationType(), new HashSet<AnnotatedMethod<?>>());
- }
- annotatedMembers.get(annotation.annotationType()).add(member);
- }
- }
- }
-
-}
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/SimpleAnnotatedClass.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/SimpleAnnotatedClass.java 2008-11-13 09:42:14 UTC (rev 297)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/SimpleAnnotatedClass.java 2008-11-13 09:55:06 UTC (rev 298)
@@ -1,284 +0,0 @@
-package org.jboss.webbeans.introspector.impl;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.jboss.webbeans.introspector.AnnotatedClass;
-import org.jboss.webbeans.introspector.AnnotatedConstructor;
-import org.jboss.webbeans.introspector.AnnotatedField;
-import org.jboss.webbeans.introspector.AnnotatedMethod;
-
-/**
- * Base class for implementing AnnotatedItem.
- *
- * @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;
-
- private Set<AnnotatedConstructor<T>> constructors;
- private Map<Class<? extends Annotation>, Set<AnnotatedConstructor<T>>> annotatedConstructors;
- private Map<List<Class<?>>, AnnotatedConstructor<T>> constructorsByArgumentMap;
-
- public SimpleAnnotatedClass(Class<T> rawType, Type type, Annotation[] annotations)
- {
- super(buildAnnotationMap(annotations));
- this.clazz = rawType;
- if (type instanceof ParameterizedType)
- {
- actualTypeArguments = ((ParameterizedType) type).getActualTypeArguments();
- }
- else
- {
- actualTypeArguments = new Type[0];
- }
- }
-
- public SimpleAnnotatedClass(Class<T> clazz)
- {
- this(clazz, clazz, clazz.getAnnotations());
- }
-
- public Class<? extends T> getAnnotatedClass()
- {
- return clazz;
- }
-
- public Class<T> getDelegate()
- {
- return clazz;
- }
-
- public Set<AnnotatedField<Object>> getFields()
- {
- if (fields == null)
- {
- initFields();
- }
- return fields;
- }
-
- public Set<AnnotatedConstructor<T>> getConstructors()
- {
- if (constructors == null)
- {
- initConstructors();
- }
- return constructors;
- }
-
- private void initFields()
- {
- this.fields = new HashSet<AnnotatedField<Object>>();
- for(Class c=clazz;c!=Object.class;c=c.getSuperclass())
- {
- for(Field field : clazz.getDeclaredFields())
- {
- if ( !field.isAccessible() ) field.setAccessible(true);
- fields.add(new SimpleAnnotatedField<Object>(field, this));
- }
- }
- }
-
- 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(Class c=clazz;c!=Object.class;c=c.getSuperclass())
- {
- for (Method method : clazz.getDeclaredMethods())
- {
- if (!method.isAccessible()) method.setAccessible(true);
- methods.add(new SimpleAnnotatedMethod<Object>(method, this));
- }
- }
- }
-
- 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.annotationType()))
- {
- annotatedMethods.put(annotation.annotationType(), new HashSet<AnnotatedMethod<Object>>());
- }
- annotatedMethods.get(annotation.annotationType()).add(member);
- }
- }
- }
-
- private void initConstructors()
- {
- this.constructors = new HashSet<AnnotatedConstructor<T>>();
- this.constructorsByArgumentMap = new HashMap<List<Class<?>>, AnnotatedConstructor<T>>();
- for (Constructor<T> constructor : clazz.getDeclaredConstructors())
- {
- AnnotatedConstructor<T> annotatedConstructor = new SimpleAnnotatedConstructor<T>(constructor, this);
- if (!constructor.isAccessible()) constructor.setAccessible(true);
- constructors.add(annotatedConstructor);
- constructorsByArgumentMap.put(Arrays.asList(constructor.getParameterTypes()), annotatedConstructor);
- }
- }
-
- public Set<AnnotatedConstructor<T>> getAnnotatedConstructors(Class<? extends Annotation> annotationType)
- {
- if (annotatedConstructors == null)
- {
- initAnnotatedConstructors();
- }
-
- if (!annotatedConstructors.containsKey(annotationType))
- {
- return new HashSet<AnnotatedConstructor<T>>();
- }
- else
- {
- return annotatedConstructors.get(annotationType);
- }
- }
-
- private void initAnnotatedConstructors()
- {
- if (constructors == null)
- {
- initConstructors();
- }
- annotatedConstructors = new HashMap<Class<? extends Annotation>, Set<AnnotatedConstructor<T>>>();
- for (AnnotatedConstructor<T> constructor : constructors)
- {
- for (Annotation annotation : constructor.getAnnotations())
- {
- if (!annotatedConstructors.containsKey(annotation.annotationType()))
- {
- annotatedConstructors.put(annotation.annotationType(), new HashSet<AnnotatedConstructor<T>>());
- }
- annotatedConstructors.get(annotation.annotationType()).add(constructor);
- }
- }
- }
-
- public AnnotatedConstructor<T> getConstructor(List<Class<?>> arguments)
- {
- return constructorsByArgumentMap.get(arguments);
- }
-
-}
\ No newline at end of file
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/SimpleAnnotatedConstructor.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/SimpleAnnotatedConstructor.java 2008-11-13 09:42:14 UTC (rev 297)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/SimpleAnnotatedConstructor.java 2008-11-13 09:55:06 UTC (rev 298)
@@ -1,184 +0,0 @@
-package org.jboss.webbeans.introspector.impl;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.webbeans.ExecutionException;
-
-import org.jboss.webbeans.ManagerImpl;
-import org.jboss.webbeans.introspector.AnnotatedConstructor;
-import org.jboss.webbeans.introspector.AnnotatedParameter;
-import org.jboss.webbeans.introspector.AnnotatedType;
-
-public class SimpleAnnotatedConstructor<T> extends AbstractAnnotatedMember<T, Constructor<T>> implements AnnotatedConstructor<T>
-{
-
- private static final Type[] actualTypeArguments = new Type[0];
-
- private Constructor<T> constructor;
-
- private List<AnnotatedParameter<Object>> parameters;
- private Map<Class<? extends Annotation>, List<AnnotatedParameter<Object>>> annotatedParameters;
-
- private AnnotatedType<T> declaringClass;
-
- public SimpleAnnotatedConstructor(Constructor<T> constructor, AnnotatedType<T> declaringClass)
- {
- super(buildAnnotationMap(constructor));
- this.constructor = constructor;
- this.declaringClass = declaringClass;
- }
-
- public Constructor<T> getAnnotatedConstructor()
- {
- return constructor;
- }
-
- public Constructor<T> getDelegate()
- {
- return constructor;
- }
-
- public Class<T> getType()
- {
- return constructor.getDeclaringClass();
- }
-
- public Type[] getActualTypeArguments()
- {
- return actualTypeArguments;
- }
-
- public List<AnnotatedParameter<Object>> getParameters()
- {
- if (parameters == null)
- {
- initParameters();
- }
- return parameters;
- }
-
- private void initParameters()
- {
- this.parameters = new ArrayList<AnnotatedParameter<Object>>();
- for (int i = 0; i < constructor.getParameterTypes().length; i++)
- {
- if (constructor.getParameterAnnotations()[i].length > 0)
- {
- Class<? extends Object> clazz = constructor.getParameterTypes()[i];
- AnnotatedParameter<Object> parameter = new SimpleAnnotatedParameter<Object>(constructor.getParameterAnnotations()[i], (Class<Object>) clazz);
- parameters.add(parameter);
- }
- else
- {
- Class<? extends Object> clazz = constructor.getParameterTypes()[i];
- AnnotatedParameter<Object> parameter = new SimpleAnnotatedParameter<Object>(new Annotation[0], (Class<Object>) clazz);
- parameters.add(parameter);
- }
- }
- }
-
- public List<AnnotatedParameter<Object>> getAnnotatedMethods(Class<? extends Annotation> annotationType)
- {
- if (annotatedParameters == null)
- {
- initAnnotatedParameters();
- }
-
- if (!annotatedParameters.containsKey(annotationType))
- {
- return new ArrayList<AnnotatedParameter<Object>>();
- }
- else
- {
- return annotatedParameters.get(annotationType);
- }
- }
-
- private void initAnnotatedParameters()
- {
- if (parameters == null)
- {
- initParameters();
- }
- annotatedParameters = new HashMap<Class<? extends Annotation>, List<AnnotatedParameter<Object>>>();
- for (AnnotatedParameter<Object> parameter : parameters)
- {
- for (Annotation annotation : parameter.getAnnotations())
- {
- if (!annotatedParameters.containsKey(annotation))
- {
- annotatedParameters.put(annotation.annotationType(), new ArrayList<AnnotatedParameter<Object>>());
- }
- annotatedParameters.get(annotation.annotationType()).add(parameter);
- }
- }
- }
-
- public List<AnnotatedParameter<Object>> getAnnotatedParameters(Class<? extends Annotation> annotationType)
- {
- if (annotatedParameters == null)
- {
- initAnnotatedParameters();
- }
- if (!annotatedParameters.containsKey(annotationType))
- {
- return new ArrayList<AnnotatedParameter<Object>>();
- }
- return annotatedParameters.get(annotationType);
- }
-
- public T newInstance(ManagerImpl manager)
- {
- try
- {
- return getDelegate().newInstance(getParameterValues(parameters, manager));
- }
- catch (IllegalArgumentException e)
- {
- throw new ExecutionException(e);
- }
- catch (InstantiationException e)
- {
- throw new ExecutionException(e);
- }
- catch (IllegalAccessException e)
- {
- throw new ExecutionException(e);
- }
- catch (InvocationTargetException e)
- {
- throw new ExecutionException(e);
- }
- }
-
- @Override
- public boolean equals(Object other)
- {
-
- if (super.equals(other) && other instanceof AnnotatedConstructor)
- {
- AnnotatedConstructor<?> that = (AnnotatedConstructor<?>) other;
- return this.getDelegate().equals(that.getDelegate());
- }
- return false;
- }
-
- @Override
- public int hashCode()
- {
- return getDelegate().hashCode();
- }
-
- public AnnotatedType<T> getDeclaringClass()
- {
- return declaringClass;
- }
-
-}
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/SimpleAnnotatedField.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/SimpleAnnotatedField.java 2008-11-13 09:42:14 UTC (rev 297)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/SimpleAnnotatedField.java 2008-11-13 09:55:06 UTC (rev 298)
@@ -1,67 +0,0 @@
-package org.jboss.webbeans.introspector.impl;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-
-import org.jboss.webbeans.ManagerImpl;
-import org.jboss.webbeans.introspector.AnnotatedField;
-import org.jboss.webbeans.introspector.AnnotatedType;
-import org.jboss.webbeans.util.Reflections;
-
-public class SimpleAnnotatedField<T> extends AbstractAnnotatedMember<T, Field> implements AnnotatedField<T>
-{
-
- private Type[] actualTypeArguments = new Type[0];
-
- private Field field;
- private AnnotatedType<?> declaringClass;
-
- public SimpleAnnotatedField(Field field, AnnotatedType<?> declaringClass)
- {
- super(buildAnnotationMap(field));
- this.field = field;
- this.declaringClass = declaringClass;
- if (field.getGenericType() instanceof ParameterizedType)
- {
- ParameterizedType type = (ParameterizedType) field.getGenericType();
- actualTypeArguments = type.getActualTypeArguments();
- }
- }
-
- public Field getAnnotatedField()
- {
- return field;
- }
-
- public Field getDelegate()
- {
- return field;
- }
-
- public Class<T> getType()
- {
- return (Class<T>) field.getType();
- }
-
- public Type[] getActualTypeArguments()
- {
- return actualTypeArguments;
- }
-
- public void inject(Object instance, ManagerImpl manager)
- {
- Reflections.setAndWrap(getDelegate(), instance, getValue(manager));
- }
-
- public String getPropertyName()
- {
- return getName();
- }
-
- public AnnotatedType<?> getDeclaringClass()
- {
- return declaringClass;
- }
-
-}
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/SimpleAnnotatedItem.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/SimpleAnnotatedItem.java 2008-11-13 09:42:14 UTC (rev 297)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/SimpleAnnotatedItem.java 2008-11-13 09:55:06 UTC (rev 298)
@@ -1,103 +0,0 @@
-package org.jboss.webbeans.introspector.impl;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.util.Map;
-
-import javax.webbeans.TypeLiteral;
-
-public class SimpleAnnotatedItem<T, S> extends AbstractAnnotatedItem<T, S>
-{
-
- private Type[] actualTypeArguments = new Type[0];
- private Class<T> type;
- private Annotation[] actualAnnotations;
-
- private SimpleAnnotatedItem(Map<Class<? extends Annotation>, Annotation> annotationMap)
- {
- super(annotationMap);
- }
-
- private SimpleAnnotatedItem(Map<Class<? extends Annotation>, Annotation> annotationMap, Class<T> type)
- {
- super(annotationMap);
- this.type = type;
- }
-
- private SimpleAnnotatedItem(Map<Class<? extends Annotation>, Annotation> annotationMap, TypeLiteral<T> apiType)
- {
- super(annotationMap);
- this.type = apiType.getRawType();
- if (apiType.getType() instanceof ParameterizedType)
- {
- actualTypeArguments = ((ParameterizedType) apiType.getType()).getActualTypeArguments();
- }
- }
-
- private SimpleAnnotatedItem(Map<Class<? extends Annotation>, Annotation> annotationMap, Class<T> type, Type[] actualTypeArguments)
- {
- this(annotationMap, type);
- this.actualTypeArguments = actualTypeArguments;
- }
-
- public SimpleAnnotatedItem(Annotation[] annotations)
- {
- this(buildAnnotationMap(annotations));
- this.actualAnnotations = annotations;
- }
-
- public SimpleAnnotatedItem(Annotation[] annotations, Class<T> type)
- {
- this(buildAnnotationMap(annotations), type);
- this.actualAnnotations = annotations;
- }
-
- public SimpleAnnotatedItem(Annotation[] annotations, TypeLiteral<T> apiType)
- {
- this(buildAnnotationMap(annotations), apiType);
- this.actualAnnotations = annotations;
- }
-
- public SimpleAnnotatedItem(Annotation[] annotations, Class<T> type, Type[] actualTypeArguments)
- {
- this(buildAnnotationMap(annotations), type, actualTypeArguments);
- this.actualAnnotations = annotations;
- }
-
- public S getDelegate()
- {
- return null;
- }
-
- public Class<T> getType()
- {
- return type;
- }
-
- public Type[] getActualTypeArguments()
- {
- return actualTypeArguments;
- }
-
- public Annotation[] getActualAnnotations()
- {
- return actualAnnotations;
- }
-
- public boolean isStatic()
- {
- return false;
- }
-
- public boolean isFinal()
- {
- return false;
- }
-
- public String getName()
- {
- throw new IllegalArgumentException("Unable to determine name");
- }
-
-}
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/SimpleAnnotatedMethod.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/SimpleAnnotatedMethod.java 2008-11-13 09:42:14 UTC (rev 297)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/SimpleAnnotatedMethod.java 2008-11-13 09:55:06 UTC (rev 298)
@@ -1,190 +0,0 @@
-package org.jboss.webbeans.introspector.impl;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.jboss.webbeans.ManagerImpl;
-import org.jboss.webbeans.introspector.AnnotatedMethod;
-import org.jboss.webbeans.introspector.AnnotatedParameter;
-import org.jboss.webbeans.introspector.AnnotatedType;
-import org.jboss.webbeans.util.Reflections;
-
-public class SimpleAnnotatedMethod<T> extends AbstractAnnotatedMember<T, Method> implements AnnotatedMethod<T>
-{
-
- private Type[] actualTypeArgements = new Type[0];
-
- private Method method;
-
- private List<AnnotatedParameter<Object>> parameters;
- private Map<Class<? extends Annotation>, List<AnnotatedParameter<Object>>> annotatedParameters;
-
- private String propertyName;
-
- private AnnotatedType<?> declaringClass;
-
- public SimpleAnnotatedMethod(Method method, AnnotatedType<?> declaringClass)
- {
- super(buildAnnotationMap(method));
- this.method = method;
- this.declaringClass = declaringClass;
- if (method.getGenericReturnType() instanceof ParameterizedType)
- {
- actualTypeArgements = ((ParameterizedType) method.getGenericReturnType()).getActualTypeArguments();
- }
- }
-
- public Method getAnnotatedMethod()
- {
- return method;
- }
-
- public Method getDelegate()
- {
- return method;
- }
-
- public Class<T> getType()
- {
- return (Class<T>) method.getReturnType();
- }
-
- public Type[] getActualTypeArguments()
- {
- return actualTypeArgements;
- }
-
- public List<AnnotatedParameter<Object>> getParameters()
- {
- if (parameters == null)
- {
- initParameters();
- }
- return parameters;
- }
-
- private void initParameters()
- {
- this.parameters = new ArrayList<AnnotatedParameter<Object>>();
- for (int i = 0; i < method.getParameterTypes().length; i++)
- {
- if (method.getParameterAnnotations()[i].length > 0)
- {
- Class<? extends Object> clazz = method.getParameterTypes()[i];
- AnnotatedParameter<Object> parameter = new SimpleAnnotatedParameter<Object>(method.getParameterAnnotations()[i], (Class<Object>) clazz);
- parameters.add(parameter);
- }
- else
- {
- Class<? extends Object> clazz = method.getParameterTypes()[i];
- AnnotatedParameter<Object> parameter = new SimpleAnnotatedParameter<Object>(new Annotation[0], (Class<Object>) clazz);
- parameters.add(parameter);
- }
- }
- }
-
- public List<AnnotatedParameter<Object>> getAnnotatedMethods(Class<? extends Annotation> annotationType)
- {
- if (annotatedParameters == null)
- {
- initAnnotatedParameters();
- }
-
- if (!annotatedParameters.containsKey(annotationType))
- {
- return new ArrayList<AnnotatedParameter<Object>>();
- }
- else
- {
- return annotatedParameters.get(annotationType);
- }
- }
-
- private void initAnnotatedParameters()
- {
- if (parameters == null)
- {
- initParameters();
- }
- annotatedParameters = new HashMap<Class<? extends Annotation>, List<AnnotatedParameter<Object>>>();
- for (AnnotatedParameter<Object> parameter : parameters)
- {
- for (Annotation annotation : parameter.getAnnotations())
- {
- if (!annotatedParameters.containsKey(annotation))
- {
- annotatedParameters.put(annotation.annotationType(), new ArrayList<AnnotatedParameter<Object>>());
- }
- annotatedParameters.get(annotation.annotationType()).add(parameter);
- }
- }
- }
-
- public List<AnnotatedParameter<Object>> getAnnotatedParameters(Class<? extends Annotation> annotationType)
- {
- if (annotatedParameters == null)
- {
- initAnnotatedParameters();
- }
- if (!annotatedParameters.containsKey(annotationType))
- {
- return new ArrayList<AnnotatedParameter<Object>>();
- }
- return annotatedParameters.get(annotationType);
- }
-
- @Override
- public boolean equals(Object other)
- {
- if (other instanceof AnnotatedMethod)
- {
- AnnotatedMethod<?> that = (AnnotatedMethod<?>) other;
- return this.getDelegate().equals(that.getDelegate());
- }
- else
- {
- return false;
- }
- }
-
- @Override
- public int hashCode()
- {
- return getDelegate().hashCode();
- }
-
- public T invoke(ManagerImpl manager, Object instance)
- {
- return (T) Reflections.invokeAndWrap(getDelegate(), instance, getParameterValues(parameters, manager));
- }
-
- public T invoke(Object instance, Object... parameters)
- {
- return (T) Reflections.invokeAndWrap(getDelegate(), instance, parameters);
- }
-
- public String getPropertyName()
- {
- if (propertyName == null)
- {
- propertyName = Reflections.getPropertyName(getDelegate());
- if (propertyName == null)
- {
- propertyName = getName();
- }
- }
- return propertyName;
- }
-
- public AnnotatedType<?> getDeclaringClass()
- {
- return declaringClass;
- }
-
-}
Deleted: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/SimpleAnnotatedParameter.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/impl/SimpleAnnotatedParameter.java 2008-11-13 09:42:14 UTC (rev 297)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/introspector/jlr/SimpleAnnotatedParameter.java 2008-11-13 09:55:06 UTC (rev 298)
@@ -1,60 +0,0 @@
-package org.jboss.webbeans.introspector.impl;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-
-import javax.webbeans.BindingType;
-
-import org.jboss.webbeans.ManagerImpl;
-import org.jboss.webbeans.introspector.AnnotatedParameter;
-
-public class SimpleAnnotatedParameter<T> extends AbstractAnnotatedItem<T, Object> implements AnnotatedParameter<T>
-{
-
- private Class<T> type;
- private Type[] actualTypeArguments = new Type[0];
- private boolean _final;
- private boolean _static;
-
- public SimpleAnnotatedParameter(Annotation[] annotations, Class<T> type)
- {
- super(buildAnnotationMap(annotations));
- this.type = type;
- }
-
- public Type[] getActualTypeArguments()
- {
- return actualTypeArguments;
- }
-
- public Object getDelegate()
- {
- return null;
- }
-
- public Class<T> getType()
- {
- return type;
- }
-
- public boolean isFinal()
- {
- return _final;
- }
-
- public boolean isStatic()
- {
- return _static;
- }
-
- public T getValue(ManagerImpl manager)
- {
- return manager.getInstanceByType(getType(), getAnnotationsAsArray(BindingType.class));
- }
-
- public String getName()
- {
- throw new IllegalArgumentException("Unable to determine name of parameter");
- }
-
-}
Modified: ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AnnotationModel.java
===================================================================
--- ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AnnotationModel.java 2008-11-13 09:42:14 UTC (rev 297)
+++ ri/trunk/webbeans-ri/src/main/java/org/jboss/webbeans/model/AnnotationModel.java 2008-11-13 09:55:06 UTC (rev 298)
@@ -5,7 +5,7 @@
import javax.webbeans.DefinitionException;
import org.jboss.webbeans.introspector.AnnotatedAnnotation;
-import org.jboss.webbeans.introspector.impl.SimpleAnnotatedAnnotation;
+import org.jboss.webbeans.introspector.jlr.AnnotatedAnnotationImpl;
public abstract class AnnotationModel<T extends Annotation>
{
@@ -15,7 +15,7 @@
public AnnotationModel(Class<T> type)
{
- this.annotatedAnnotation = new SimpleAnnotatedAnnotation<T>(type);
+ this.annotatedAnnotation = new AnnotatedAnnotationImpl<T>(type);
init();
}
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-13 09:42:14 UTC (rev 297)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ClassAnnotatedItemTest.java 2008-11-13 09:55:06 UTC (rev 298)
@@ -9,7 +9,7 @@
import javax.webbeans.Stereotype;
import org.jboss.webbeans.introspector.AnnotatedClass;
-import org.jboss.webbeans.introspector.impl.SimpleAnnotatedClass;
+import org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl;
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()
{
- AnnotatedClass<Order> annotatedElement = new SimpleAnnotatedClass<Order>(Order.class);
+ AnnotatedClass<Order> annotatedElement = new AnnotatedClassImpl<Order>(Order.class);
assert annotatedElement.getAnnotations().size() == 1;
assert annotatedElement.getAnnotation(Production.class) != null;
assert annotatedElement.getType().equals(Order.class);
@@ -29,7 +29,7 @@
@Test
public void testMetaAnnotations()
{
- AnnotatedClass<Order> annotatedElement = new SimpleAnnotatedClass<Order>(Order.class);
+ AnnotatedClass<Order> annotatedElement = new AnnotatedClassImpl<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()
{
- AnnotatedClass<Order> annotatedElement = new SimpleAnnotatedClass<Order>(Order.class);
+ AnnotatedClass<Order> annotatedElement = new AnnotatedClassImpl<Order>(Order.class);
assert annotatedElement.getAnnotation(Stereotype.class) == null;
assert annotatedElement.getAnnotations(Stereotype.class).size() == 0;
- AnnotatedClass<Antelope> classWithNoAnnotations = new SimpleAnnotatedClass<Antelope>(Antelope.class);
+ AnnotatedClass<Antelope> classWithNoAnnotations = new AnnotatedClassImpl<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-13 09:42:14 UTC (rev 297)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/DeferredEventNotificationTest.java 2008-11-13 09:55:06 UTC (rev 298)
@@ -11,8 +11,8 @@
import org.jboss.webbeans.bean.SimpleBean;
import org.jboss.webbeans.introspector.AnnotatedMethod;
-import org.jboss.webbeans.introspector.impl.SimpleAnnotatedClass;
-import org.jboss.webbeans.introspector.impl.SimpleAnnotatedMethod;
+import org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl;
+import org.jboss.webbeans.introspector.jlr.AnnotatedMethodImpl;
import org.jboss.webbeans.test.annotations.AnotherDeploymentType;
import org.jboss.webbeans.test.annotations.Asynchronous;
import org.jboss.webbeans.test.beans.Tuna;
@@ -74,7 +74,7 @@
//AnnotatedClass<Tuna> annotatedItem = new SimpleAnnotatedClass<Tuna>(Tuna.class, annotations);
// TODO This should test a real class
tuna = createSimpleBean(Tuna.class, manager);
- om = new SimpleAnnotatedMethod<Object>(AnObserver.class.getMethod("observe", new Class[] { Event.class }), new SimpleAnnotatedClass<AnObserver>(AnObserver.class));
+ om = new AnnotatedMethodImpl<Object>(AnObserver.class.getMethod("observe", new Class[] { Event.class }), new AnnotatedClassImpl<AnObserver>(AnObserver.class));
AnObserver observerInstance = new AnObserver();
// TODO Fix this Observer<Event> observer = new MockObserverImpl<Event>(tuna, om, Event.class);
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InstantiationByNameTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InstantiationByNameTest.java 2008-11-13 09:42:14 UTC (rev 297)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InstantiationByNameTest.java 2008-11-13 09:55:06 UTC (rev 298)
@@ -8,8 +8,8 @@
import org.jboss.webbeans.ResolutionManager;
import org.jboss.webbeans.introspector.AnnotatedClass;
import org.jboss.webbeans.introspector.AnnotatedField;
-import org.jboss.webbeans.introspector.impl.SimpleAnnotatedClass;
-import org.jboss.webbeans.introspector.impl.SimpleAnnotatedField;
+import org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl;
+import org.jboss.webbeans.introspector.jlr.AnnotatedFieldImpl;
import org.jboss.webbeans.test.beans.Cod;
import org.jboss.webbeans.test.beans.FishFarm;
import org.jboss.webbeans.test.beans.Haddock;
@@ -24,12 +24,12 @@
public class InstantiationByNameTest extends AbstractTest
{
- private AnnotatedClass<FishFarm> fishFarmClass = new SimpleAnnotatedClass<FishFarm>(FishFarm.class);
+ private AnnotatedClass<FishFarm> fishFarmClass = new AnnotatedClassImpl<FishFarm>(FishFarm.class);
@Test(groups="resolution") @SpecAssertion(section="4.10")
public void testNoWebBeansFound() throws Exception
{
- AnnotatedField<ScottishFish> whiteScottishFishField = new SimpleAnnotatedField<ScottishFish>(FishFarm.class.getDeclaredField("whiteScottishFish"), fishFarmClass);
+ AnnotatedField<ScottishFish> whiteScottishFishField = new AnnotatedFieldImpl<ScottishFish>(FishFarm.class.getDeclaredField("whiteScottishFish"), fishFarmClass);
Bean<Cod> codBean = createSimpleBean(Cod.class, manager);
Bean<Salmon> salmonBean = createSimpleBean(Salmon.class, manager);
manager.addBean(codBean);
@@ -44,7 +44,7 @@
@Test(expectedExceptions=AmbiguousDependencyException.class) @SpecAssertion(section="4.10.1")
public void testAmbiguousDependencies() throws Exception
{
- AnnotatedField<ScottishFish> whiteScottishFishField = new SimpleAnnotatedField<ScottishFish>(FishFarm.class.getDeclaredField("whiteScottishFish"), fishFarmClass);
+ AnnotatedField<ScottishFish> whiteScottishFishField = new AnnotatedFieldImpl<ScottishFish>(FishFarm.class.getDeclaredField("whiteScottishFish"), fishFarmClass);
Bean<Cod> codBean = createSimpleBean(Cod.class, manager);
Bean<Salmon> salmonBean = createSimpleBean(Salmon.class, manager);
Bean<Sole> soleBean = createSimpleBean(Sole.class, manager);
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InstantiationByTypeTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InstantiationByTypeTest.java 2008-11-13 09:42:14 UTC (rev 297)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/InstantiationByTypeTest.java 2008-11-13 09:55:06 UTC (rev 298)
@@ -13,8 +13,8 @@
import org.jboss.webbeans.bindings.CurrentAnnotationLiteral;
import org.jboss.webbeans.introspector.AnnotatedClass;
import org.jboss.webbeans.introspector.AnnotatedField;
-import org.jboss.webbeans.introspector.impl.SimpleAnnotatedClass;
-import org.jboss.webbeans.introspector.impl.SimpleAnnotatedField;
+import org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl;
+import org.jboss.webbeans.introspector.jlr.AnnotatedFieldImpl;
import org.jboss.webbeans.test.annotations.Whitefish;
import org.jboss.webbeans.test.beans.Cod;
import org.jboss.webbeans.test.beans.FishFarm;
@@ -31,7 +31,7 @@
public class InstantiationByTypeTest extends AbstractTest
{
- private AnnotatedClass<FishFarm> fishFarmClass = new SimpleAnnotatedClass<FishFarm>(FishFarm.class);
+ private AnnotatedClass<FishFarm> fishFarmClass = new AnnotatedClassImpl<FishFarm>(FishFarm.class);
@Test(groups={"resolution", "beanLifecycle"}) @SpecAssertion(section="4.9")
public void testCurrentBindingTypeAssumed()
@@ -56,7 +56,7 @@
@Test(expectedExceptions=AmbiguousDependencyException.class) @SpecAssertion(section="4.9")
public void testAmbiguousDependencies() throws Exception
{
- AnnotatedField<ScottishFish> whiteScottishFishField = new SimpleAnnotatedField<ScottishFish>(FishFarm.class.getDeclaredField("whiteScottishFish"), fishFarmClass);
+ AnnotatedField<ScottishFish> whiteScottishFishField = new AnnotatedFieldImpl<ScottishFish>(FishFarm.class.getDeclaredField("whiteScottishFish"), fishFarmClass);
Bean<Cod> codBean = createSimpleBean(Cod.class, manager);
Bean<Salmon> salmonBean = createSimpleBean(Salmon.class, manager);
Bean<Sole> soleBean = createSimpleBean(Sole.class, manager);
@@ -74,7 +74,7 @@
@Test(expectedExceptions=UnsatisfiedDependencyException.class) @SpecAssertion(section="4.9")
public void testUnsatisfiedDependencies() throws Exception
{
- AnnotatedField<ScottishFish> whiteScottishFishField = new SimpleAnnotatedField<ScottishFish>(FishFarm.class.getDeclaredField("whiteScottishFish"), fishFarmClass);
+ AnnotatedField<ScottishFish> whiteScottishFishField = new AnnotatedFieldImpl<ScottishFish>(FishFarm.class.getDeclaredField("whiteScottishFish"), fishFarmClass);
Bean<Cod> codBean = createSimpleBean(Cod.class, manager);
Bean<Salmon> salmonBean = createSimpleBean(Salmon.class, manager);
Bean<Sole> soleBean = createSimpleBean(Sole.class, manager);
@@ -92,7 +92,7 @@
@Test(expectedExceptions=UnproxyableDependencyException.class) @SpecAssertion(section="4.9")
public void testUnproxyableDependencies() throws Exception
{
- AnnotatedField<Plaice> plaiceField = new SimpleAnnotatedField<Plaice>(PlaiceFarm.class.getDeclaredField("plaice"), fishFarmClass);
+ AnnotatedField<Plaice> plaiceField = new AnnotatedFieldImpl<Plaice>(PlaiceFarm.class.getDeclaredField("plaice"), fishFarmClass);
Bean<Plaice> plaiceBean = createSimpleBean(Plaice.class, manager);
manager.addBean(plaiceBean);
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-13 09:42:14 UTC (rev 297)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ObserverTest.java 2008-11-13 09:55:06 UTC (rev 298)
@@ -10,8 +10,8 @@
import org.jboss.webbeans.bean.SimpleBean;
import org.jboss.webbeans.introspector.AnnotatedMethod;
-import org.jboss.webbeans.introspector.impl.SimpleAnnotatedClass;
-import org.jboss.webbeans.introspector.impl.SimpleAnnotatedMethod;
+import org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl;
+import org.jboss.webbeans.introspector.jlr.AnnotatedMethodImpl;
import org.jboss.webbeans.test.annotations.AnotherDeploymentType;
import org.jboss.webbeans.test.annotations.Asynchronous;
import org.jboss.webbeans.test.beans.Tuna;
@@ -64,7 +64,7 @@
//AnnotatedClass<Tuna> annotatedItem = new SimpleAnnotatedClass<Tuna>(Tuna.class, annotations);
tuna = createSimpleBean(Tuna.class, manager);
- om = new SimpleAnnotatedMethod<Object>(AnObserver.class.getMethod("observe", new Class[] { SampleEvent.class }), new SimpleAnnotatedClass<AnObserver>(AnObserver.class));
+ om = new AnnotatedMethodImpl<Object>(AnObserver.class.getMethod("observe", new Class[] { SampleEvent.class }), new AnnotatedClassImpl<AnObserver>(AnObserver.class));
}
/**
Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ResolutionByTypeTest.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ResolutionByTypeTest.java 2008-11-13 09:42:14 UTC (rev 297)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/ResolutionByTypeTest.java 2008-11-13 09:55:06 UTC (rev 298)
@@ -17,8 +17,8 @@
import org.jboss.webbeans.bindings.CurrentAnnotationLiteral;
import org.jboss.webbeans.introspector.AnnotatedClass;
import org.jboss.webbeans.introspector.AnnotatedField;
-import org.jboss.webbeans.introspector.impl.SimpleAnnotatedClass;
-import org.jboss.webbeans.introspector.impl.SimpleAnnotatedField;
+import org.jboss.webbeans.introspector.jlr.AnnotatedClassImpl;
+import org.jboss.webbeans.introspector.jlr.AnnotatedFieldImpl;
import org.jboss.webbeans.test.annotations.Expensive;
import org.jboss.webbeans.test.annotations.Whitefish;
import org.jboss.webbeans.test.beans.Animal;
@@ -49,12 +49,12 @@
public class ResolutionByTypeTest extends AbstractTest
{
- private AnnotatedClass<FishFarm> fishFarmClass = new SimpleAnnotatedClass<FishFarm>(FishFarm.class);
+ private AnnotatedClass<FishFarm> fishFarmClass = new AnnotatedClassImpl<FishFarm>(FishFarm.class);
@Test(groups="resolution")
public void testAnnotatedField() throws Exception
{
- AnnotatedField<Tuna> tuna = new SimpleAnnotatedField<Tuna>(FishFarm.class.getDeclaredField("tuna"), fishFarmClass);
+ AnnotatedField<Tuna> tuna = new AnnotatedFieldImpl<Tuna>(FishFarm.class.getDeclaredField("tuna"), fishFarmClass);
assert tuna.getType().isAssignableFrom(Tuna.class);
assert tuna.getBindingTypes().size() == 1;
assert tuna.getBindingTypes().contains(new CurrentAnnotationLiteral());
@@ -64,7 +64,7 @@
@Test(groups="resolution") @SpecAssertion(section="4.9.2")
public void testSingleApiTypeWithCurrent() throws Exception
{
- AnnotatedField<Tuna> tunaField = new SimpleAnnotatedField<Tuna>(FishFarm.class.getDeclaredField("tuna"), fishFarmClass);
+ AnnotatedField<Tuna> tunaField = new AnnotatedFieldImpl<Tuna>(FishFarm.class.getDeclaredField("tuna"), fishFarmClass);
Bean<Tuna> tunaBean = createSimpleBean(Tuna.class, manager);
manager.addBean(tunaBean);
Set<Bean<Tuna>> possibleTargets = manager.getResolutionManager().get(tunaField);
@@ -87,7 +87,7 @@
@Test
public void testOneBindingType() throws Exception
{
- AnnotatedField<ScottishFish> whiteScottishFishField = new SimpleAnnotatedField<ScottishFish>(FishFarm.class.getDeclaredField("whiteScottishFish"), fishFarmClass);
+ AnnotatedField<ScottishFish> whiteScottishFishField = new AnnotatedFieldImpl<ScottishFish>(FishFarm.class.getDeclaredField("whiteScottishFish"), fishFarmClass);
Bean<Cod> codBean = createSimpleBean(Cod.class, manager);
Bean<Salmon> salmonBean = createSimpleBean(Salmon.class, manager);
Bean<Sole> soleBean = createSimpleBean(Sole.class, manager);
@@ -103,7 +103,7 @@
@Test
public void testABindingType() throws Exception
{
- AnnotatedField<Animal> whiteChunkyFishField = new SimpleAnnotatedField<Animal>(FishFarm.class.getDeclaredField("realChunkyWhiteFish"), fishFarmClass);
+ AnnotatedField<Animal> whiteChunkyFishField = new AnnotatedFieldImpl<Animal>(FishFarm.class.getDeclaredField("realChunkyWhiteFish"), fishFarmClass);
Bean<Cod> codBean = createSimpleBean(Cod.class, manager);
Bean<Salmon> salmonBean = createSimpleBean(Salmon.class, manager);
@@ -120,7 +120,7 @@
@Test
public void testMultipleApiTypeWithCurrent() throws Exception
{
- AnnotatedField<Animal> animalField = new SimpleAnnotatedField<Animal>(FishFarm.class.getDeclaredField("animal"), fishFarmClass);
+ AnnotatedField<Animal> animalField = new AnnotatedFieldImpl<Animal>(FishFarm.class.getDeclaredField("animal"), fishFarmClass);
Bean<SeaBass> seaBassBean = createSimpleBean(SeaBass.class, manager);
Bean<Haddock> haddockBean = createSimpleBean(Haddock.class, manager);
manager.addBean(seaBassBean);
@@ -192,7 +192,7 @@
@Test(groups="resolution") @SpecAssertion(section="4.9.2")
public void testResolveByTypeWithTypeParameter() throws Exception
{
- AnnotatedField<Farmer<ScottishFish>> scottishFishFarmerField = new SimpleAnnotatedField<Farmer<ScottishFish>>(FishFarm.class.getDeclaredField("scottishFishFarmer"), fishFarmClass);
+ AnnotatedField<Farmer<ScottishFish>> scottishFishFarmerField = new AnnotatedFieldImpl<Farmer<ScottishFish>>(FishFarm.class.getDeclaredField("scottishFishFarmer"), fishFarmClass);
Bean<ScottishFishFarmer> scottishFishFarmerBean = createSimpleBean(ScottishFishFarmer.class, manager);
Bean<AnimalFarmer> farmerBean = createSimpleBean(AnimalFarmer.class, manager);
@@ -226,7 +226,7 @@
@Test @SpecAssertion(section="4.9.2")
public void testOnlyHighestEnabledPreecedenceWebBeansResolved() throws Exception
{
- AnnotatedField<Animal> whiteFishField = new SimpleAnnotatedField<Animal>(FishFarm.class.getDeclaredField("whiteFish"), fishFarmClass);
+ AnnotatedField<Animal> whiteFishField = new AnnotatedFieldImpl<Animal>(FishFarm.class.getDeclaredField("whiteFish"), fishFarmClass);
Bean<Cod> codBean = createSimpleBean(Cod.class, manager);
Bean<Sole> soleBean = createSimpleBean(Sole.class, manager);
Bean<Plaice> plaiceBean = createSimpleBean(Plaice.class, manager);
@@ -248,7 +248,7 @@
@Test(groups="resolution") @SpecAssertion(section="4.9.2")
public void testResolveByTypeWithNonBindingMembers() throws Exception
{
- AnnotatedField<Animal> veryExpensiveWhitefishField = new SimpleAnnotatedField<Animal>(FishFarm.class.getDeclaredField("veryExpensiveWhitefish"), fishFarmClass);
+ AnnotatedField<Animal> veryExpensiveWhitefishField = new AnnotatedFieldImpl<Animal>(FishFarm.class.getDeclaredField("veryExpensiveWhitefish"), fishFarmClass);
Bean<Halibut> halibutBean = createSimpleBean(Halibut.class, manager);
Bean<RoundWhitefish> roundWhiteFishBean = createSimpleBean(RoundWhitefish.class, manager);
Bean<Sole> soleBean = createSimpleBean(Sole.class, manager);
@@ -282,7 +282,7 @@
@Test(groups="resolution") @SpecAssertion(section="4.9.2")
public void testNoWebBeansFound() throws Exception
{
- AnnotatedField<ScottishFish> whiteScottishFishField = new SimpleAnnotatedField<ScottishFish>(FishFarm.class.getDeclaredField("whiteScottishFish"), fishFarmClass);
+ AnnotatedField<ScottishFish> whiteScottishFishField = new AnnotatedFieldImpl<ScottishFish>(FishFarm.class.getDeclaredField("whiteScottishFish"), fishFarmClass);
Bean<Salmon> salmonBean = createSimpleBean(Salmon.class, manager);
Bean<Sole> soleBean = createSimpleBean(Sole.class, manager);
Bean<Plaice> plaiceBean = createSimpleBean(Plaice.class, manager);
More information about the weld-commits
mailing list