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

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Thu Mar 12 12:53:48 EDT 2009


Author: pete.muir at jboss.org
Date: 2009-03-12 12:53:48 -0400 (Thu, 12 Mar 2009)
New Revision: 1945

Modified:
   ri/trunk/api/src/main/java/javax/inject/manager/Bean.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ForwardingBean.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/ResolvableAnnotatedClass.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/AnnotatedItem.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingAnnotatedItem.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedMember.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedType.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedAnnotationImpl.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedFieldImpl.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedParameterImpl.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Beans.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Names.java
   ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Proxies.java
Log:
WBRI-108

Modified: ri/trunk/api/src/main/java/javax/inject/manager/Bean.java
===================================================================
--- ri/trunk/api/src/main/java/javax/inject/manager/Bean.java	2009-03-12 16:51:55 UTC (rev 1944)
+++ ri/trunk/api/src/main/java/javax/inject/manager/Bean.java	2009-03-12 16:53:48 UTC (rev 1945)
@@ -60,7 +60,7 @@
     * 
     * @return the bean types
     */
-   public abstract Set<Type> getTypes();
+   public abstract Set<? extends Type> getTypes();
 
    /**
     * The bindings of a bean

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java	2009-03-12 16:51:55 UTC (rev 1944)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractBean.java	2009-03-12 16:53:48 UTC (rev 1945)
@@ -48,7 +48,6 @@
 import org.jboss.webbeans.log.Logging;
 import org.jboss.webbeans.metadata.MergedStereotypes;
 import org.jboss.webbeans.metadata.MetaDataCache;
-import org.jboss.webbeans.util.Beans;
 import org.jboss.webbeans.util.Reflections;
 
 /**
@@ -107,7 +106,7 @@
    // The type
    protected Class<T> type;
    // The API types
-   protected Set<Type> types;
+   protected Set<? extends Type> types;
    // The injection points
    protected Set<AnnotatedInjectionPoint<?, ?>> injectionPoints;
    // If the type a primitive?
@@ -163,7 +162,7 @@
     */
    protected void initTypes()
    {
-      types = new Reflections.HierarchyDiscovery<Type>(getAnnotatedItem().getUnderlyingType()).getFlattenedTypes();
+      types = getAnnotatedItem().getFlattenedTypeHierarchy();
    }
 
    /**
@@ -245,7 +244,7 @@
 
    protected void initProxyable()
    {
-      proxyable = Beans.apiTypesAreProxyable(getTypes());
+      proxyable = getAnnotatedItem().isProxyable();
    }
 
    /**
@@ -459,7 +458,7 @@
     * @see javax.inject.manager.Bean#getTypes()
     */
    @Override
-   public Set<Type> getTypes()
+   public Set<? extends Type> getTypes()
    {
       return types;
    }

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java	2009-03-12 16:51:55 UTC (rev 1944)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/AbstractProducerBean.java	2009-03-12 16:53:48 UTC (rev 1945)
@@ -20,7 +20,6 @@
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Field;
-import java.lang.reflect.Member;
 import java.lang.reflect.Method;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
@@ -94,14 +93,18 @@
    {
       if (getType().isArray() || getType().isPrimitive())
       {
+         Set<Type> types = new HashSet<Type>();
          types = new HashSet<Type>();
          types.add(getType());
          types.add(Object.class);
+         super.types = types;
       }
       else if (getType().isInterface())
       {
-         super.initTypes();
+         Set<Type> types = new HashSet<Type>();
          types.add(Object.class);
+         types.addAll(getAnnotatedItem().getFlattenedTypeHierarchy());
+         super.types = types;
       }
       else
       {

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java	2009-03-12 16:51:55 UTC (rev 1944)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/EnterpriseBean.java	2009-03-12 16:53:48 UTC (rev 1945)
@@ -20,6 +20,7 @@
 import java.lang.reflect.Method;
 import java.lang.reflect.Type;
 import java.util.Arrays;
+import java.util.HashSet;
 import java.util.LinkedHashSet;
 import java.util.Set;
 
@@ -123,12 +124,14 @@
 
    protected void initTypes()
    {
+      Set<Type> types = new HashSet<Type>();
       types = new LinkedHashSet<Type>();
       types.add(Object.class);
       for (BusinessInterfaceDescriptor<?> businessInterfaceDescriptor : ejbDescriptor.getLocalBusinessInterfaces())
       {
          types.add(businessInterfaceDescriptor.getInterface());
       }
+      super.types = types;
    }
 
    protected void initProxyClass()

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ForwardingBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ForwardingBean.java	2009-03-12 16:51:55 UTC (rev 1944)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/ForwardingBean.java	2009-03-12 16:53:48 UTC (rev 1945)
@@ -115,7 +115,7 @@
     * @return The API types
     */
    @Override
-   public Set<Type> getTypes()
+   public Set<? extends Type> getTypes()
    {
       return delegate().getTypes();
    }

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/ResolvableAnnotatedClass.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/ResolvableAnnotatedClass.java	2009-03-12 16:51:55 UTC (rev 1944)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/ResolvableAnnotatedClass.java	2009-03-12 16:53:48 UTC (rev 1945)
@@ -8,6 +8,7 @@
 import java.lang.reflect.Type;
 import java.util.Arrays;
 import java.util.HashSet;
+import java.util.Set;
 
 import javax.inject.TypeLiteral;
 
@@ -111,5 +112,16 @@
    {
       throw new UnsupportedOperationException();
    }
+   
+   public Set<? extends Type> getFlattenedTypeHierarchy()
+   {
+      throw new UnsupportedOperationException();
+   }
+   
+   @Override
+   public boolean isProxyable()
+   {
+      throw new UnsupportedOperationException();
+   }
 
 }
\ No newline at end of file

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/AnnotatedItem.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/AnnotatedItem.java	2009-03-12 16:51:55 UTC (rev 1944)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/AnnotatedItem.java	2009-03-12 16:53:48 UTC (rev 1945)
@@ -105,6 +105,8 @@
     * @return An annotation if found, null if the annotation wasn't present.
     */
    public <A extends Annotation> A getAnnotation(Class<A> annotationType);
+   
+   public Set<? extends Type> getFlattenedTypeHierarchy();
 
    /**
     * Indicates if an annotation type specified is present
@@ -149,7 +151,7 @@
     * @param types The set of types to match
     * @return True if assignable, false otherwise.
     */
-   public boolean isAssignableFrom(Set<Type> types);
+   public boolean isAssignableFrom(Set<? extends Type> types);
 
    /**
     * Gets the actual type arguments for any parameterized types that this

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingAnnotatedItem.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingAnnotatedItem.java	2009-03-12 16:51:55 UTC (rev 1944)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/ForwardingAnnotatedItem.java	2009-03-12 16:53:48 UTC (rev 1945)
@@ -135,7 +135,7 @@
    /**
     * @see org.jboss.webbeans.introspector.AnnotatedItem
     */
-   public boolean isAssignableFrom(Set<Type> types)
+   public boolean isAssignableFrom(Set<? extends Type> types)
    {
       return delegate().isAssignableFrom(types);
    }
@@ -218,5 +218,10 @@
    {
       return delegate().isDeclaredAnnotationPresent(annotationType);
    }
+   
+   public Set<? extends Type> getFlattenedTypeHierarchy()
+   {
+      return delegate().getFlattenedTypeHierarchy();
+   }
 
 }

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java	2009-03-12 16:51:55 UTC (rev 1944)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedItem.java	2009-03-12 16:53:48 UTC (rev 1945)
@@ -61,6 +61,9 @@
    // Cached string representation
    private String toString;
    private final AnnotationStore annotationStore;
+   private final Class<T> type;
+   private final Set<? extends Type> flattenedTypes;
+   private final boolean proxyable;
 
    /**
     * Constructor
@@ -71,9 +74,20 @@
     * @param annotationMap A map of annotation to register
     * 
     */
+   public AbstractAnnotatedItem(AnnotationStore annotatedItemHelper, Class<T> type)
+   {
+      this.annotationStore = annotatedItemHelper;
+      this.type = type;
+      this.flattenedTypes = new Reflections.HierarchyDiscovery<Type>(type).getFlattenedTypes();
+      this.proxyable = Proxies.isTypesProxyable(flattenedTypes);
+   }
+   
    public AbstractAnnotatedItem(AnnotationStore annotatedItemHelper)
    {
       this.annotationStore = annotatedItemHelper;
+      this.type = null;
+      this.flattenedTypes = null;
+      this.proxyable = false;
    }
    
    public AnnotationStore getAnnotationStore()
@@ -158,7 +172,7 @@
     * 
     * @see org.jboss.webbeans.introspector.AnnotatedItem#isAssignableFrom(Set)
     */
-   public boolean isAssignableFrom(Set<Type> types)
+   public boolean isAssignableFrom(Set<? extends Type> types)
    {
       for (Type type : types)
       {
@@ -255,8 +269,18 @@
     */
    public boolean isProxyable()
    {
-      return Proxies.isTypeProxyable(getType());
+      return proxyable;
    }
+   
+   public Class<T> getType()
+   {
+      return type;
+   }
+   
+   public Set<? extends Type> getFlattenedTypeHierarchy()
+   {
+      return flattenedTypes;
+   }
 
    public abstract S getDelegate();
    

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedMember.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedMember.java	2009-03-12 16:51:55 UTC (rev 1944)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedMember.java	2009-03-12 16:53:48 UTC (rev 1945)
@@ -110,9 +110,9 @@
     * 
     * @param annotationMap The annotation map
     */
-   public AbstractAnnotatedMember(AnnotationStore annotatedItemHelper, Member member)
+   public AbstractAnnotatedMember(AnnotationStore annotatedItemHelper, Member member, Class<T> type)
    {
-      super(annotatedItemHelper);
+      super(annotatedItemHelper, type);
       name = member.getName();
       _public = Modifier.isPublic(member.getModifiers());
    }

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedType.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedType.java	2009-03-12 16:51:55 UTC (rev 1944)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AbstractAnnotatedType.java	2009-03-12 16:53:48 UTC (rev 1945)
@@ -54,7 +54,7 @@
     */
    public AbstractAnnotatedType(AnnotationStore annotatedItemHelper, Class<T> type)
    {
-      super(annotatedItemHelper);
+      super(annotatedItemHelper, type);
       this.name = type.getName();
       this._simpleName = type.getSimpleName();
       if (type.getSuperclass() != null)

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedAnnotationImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedAnnotationImpl.java	2009-03-12 16:51:55 UTC (rev 1944)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedAnnotationImpl.java	2009-03-12 16:53:48 UTC (rev 1945)
@@ -153,16 +153,6 @@
    }
 
    /**
-    * Gets the type of the annotation
-    * 
-    * @see org.jboss.webbeans.introspector.AnnotatedAnnotation#getType()
-    */
-   public Class<T> getType()
-   {
-      return clazz;
-   }
-
-   /**
     * Returns the annotated members with a given annotation type
     * 
     * If the annotated members are null, they are initialized first.
@@ -202,5 +192,4 @@
    {
       throw new UnsupportedOperationException();
    }
-
 }

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java	2009-03-12 16:51:55 UTC (rev 1944)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedClassImpl.java	2009-03-12 16:53:48 UTC (rev 1945)
@@ -257,6 +257,7 @@
    private final boolean _nonStaticMemberClass;
    private final boolean _parameterizedType;
    private final boolean _abstract;
+
    
    public static <T> AnnotatedClass<T> of(Class<T> clazz)
    {
@@ -475,16 +476,6 @@
       return Collections.unmodifiableSet(annotatedFields.get(annotationType));
    }
    
-   /**
-    * Gets the type of the class
-    * 
-    * @return The type
-    */
-   public Class<T> getType()
-   {
-      return clazz;
-   }
-   
    public boolean isNonStaticMemberClass()
    {
       return _nonStaticMemberClass;

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java	2009-03-12 16:51:55 UTC (rev 1944)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedConstructorImpl.java	2009-03-12 16:53:48 UTC (rev 1945)
@@ -77,7 +77,7 @@
     */
    public AnnotatedConstructorImpl(Constructor<T> constructor, AnnotatedType<T> declaringClass)
    {
-      super(AnnotationStore.of(constructor), constructor);
+      super(AnnotationStore.of(constructor), constructor, constructor.getDeclaringClass());
       this.constructor = constructor;
       this.declaringClass = declaringClass;
 
@@ -131,16 +131,6 @@
    }
 
    /**
-    * Gets the type of the constructor
-    * 
-    * @return The type of the constructor
-    */
-   public Class<T> getType()
-   {
-      return constructor.getDeclaringClass();
-   }
-
-   /**
     * Gets the actual type arguments
     * 
     * @return The type arguments

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedFieldImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedFieldImpl.java	2009-03-12 16:51:55 UTC (rev 1944)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedFieldImpl.java	2009-03-12 16:53:48 UTC (rev 1945)
@@ -60,7 +60,7 @@
     */
    public AnnotatedFieldImpl(Field field, AnnotatedType<?> declaringClass)
    {
-      super(AnnotationStore.of(field), field);
+      super(AnnotationStore.of(field), field, (Class<T>) field.getType());
       this.field = field;
       field.setAccessible(true);
       this.declaringClass = declaringClass;
@@ -91,17 +91,6 @@
    }
 
    /**
-    * Gets the type
-    * 
-    * @return The type
-    */
-   @SuppressWarnings("unchecked")
-   public Class<T> getType()
-   {
-      return (Class<T>) field.getType();
-   }
-
-   /**
     * Gets the actual type arguments
     * 
     * @return The type arguments
@@ -189,5 +178,5 @@
    {
       return getDelegate().hashCode();
    }
-      
+   
 }

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java	2009-03-12 16:51:55 UTC (rev 1944)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedMethodImpl.java	2009-03-12 16:53:48 UTC (rev 1945)
@@ -26,6 +26,7 @@
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
+import java.util.Set;
 
 import org.jboss.webbeans.introspector.AnnotatedMethod;
 import org.jboss.webbeans.introspector.AnnotatedParameter;
@@ -68,6 +69,8 @@
    // Cached string representation
    private String toString;
    
+   private final Set<? extends Type> flattenedTypes;
+   
    public static <T> AnnotatedMethodImpl<T> of(Method method, AnnotatedType<?> declaringClass)
    {
       return new AnnotatedMethodImpl<T>(method, declaringClass);
@@ -85,7 +88,7 @@
    @SuppressWarnings("unchecked")
    protected AnnotatedMethodImpl(Method method, AnnotatedType<?> declaringClass)
    {
-      super(AnnotationStore.of(method), method);
+      super(AnnotationStore.of(method), method, (Class<T>) method.getReturnType());
       this.method = method;
       this.method.setAccessible(true);
       this.declaringClass = declaringClass;
@@ -93,11 +96,13 @@
       if (method.getGenericReturnType() instanceof ParameterizedType)
       {
          this.underlyingType = method.getGenericReturnType();
+         this.flattenedTypes = new Reflections.HierarchyDiscovery<Type>(underlyingType).getFlattenedTypes();
          this.actualTypeArguments = ((ParameterizedType) underlyingType).getActualTypeArguments();
       }
       else
       {
          this.underlyingType = type;
+         this.flattenedTypes = super.getFlattenedTypeHierarchy();
          this.actualTypeArguments = new Type[0];
       }
 
@@ -123,7 +128,7 @@
             Class<? extends Object> clazz = method.getParameterTypes()[i];
             AnnotatedParameter<Object> parameter = new AnnotatedParameterImpl<Object>(new Annotation[0], (Class<Object>) clazz, this);
             this.parameters.add(parameter);
-         }
+         }  
       }
 
       String propertyName = Reflections.getPropertyName(getDelegate());
@@ -146,12 +151,6 @@
    {
       return method;
    }
-
-   @SuppressWarnings("unchecked")
-   public Class<T> getType()
-   {
-      return type;
-   }
    
    @Override
    public Type getUnderlyingType()
@@ -240,6 +239,11 @@
       toString = "Annotated method on class " + getDeclaringClass().getName() + Names.methodToString(method);
       return toString;
    }
-      
-
+   
+   @Override
+   public Set<? extends Type> getFlattenedTypeHierarchy()
+   {
+      return flattenedTypes;
+   }
+   
 }

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedParameterImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedParameterImpl.java	2009-03-12 16:51:55 UTC (rev 1944)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/introspector/jlr/AnnotatedParameterImpl.java	2009-03-12 16:53:48 UTC (rev 1945)
@@ -67,7 +67,7 @@
     */
    public AnnotatedParameterImpl(Annotation[] annotations, Class<T> type, AnnotatedMember<?, ?> declaringMember)
    {
-      super(AnnotationStore.of(annotations, annotations));
+      super(AnnotationStore.of(annotations, annotations), type);
       this.type = type;
       this.declaringMember = declaringMember;
    }
@@ -97,18 +97,6 @@
    }
 
    /**
-    * Gets the type of the parameter
-    * 
-    * @return The type
-    * 
-    * @see org.jboss.webbeans.introspector.AnnotatedItem#getType()
-    */
-   public Class<T> getType()
-   {
-      return type;
-   }
-
-   /**
     * Indicates if the parameter is final
     * 
     * @return True if final, false otherwise
@@ -195,5 +183,5 @@
    {
       throw new UnsupportedOperationException();
    }
-
+   
 }

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Beans.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Beans.java	2009-03-12 16:51:55 UTC (rev 1944)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Beans.java	2009-03-12 16:53:48 UTC (rev 1945)
@@ -16,7 +16,6 @@
  */
 package org.jboss.webbeans.util;
 
-import java.lang.reflect.Type;
 import java.util.HashSet;
 import java.util.Set;
 
@@ -73,32 +72,10 @@
       }
       else
       {
-         return Beans.apiTypesAreProxyable(bean.getTypes());
+         return Proxies.isTypesProxyable(bean.getTypes());
       }
    }
 
-   /**
-    * Indicates if a set of types are all proxyable
-    * 
-    * @param types The types to test
-    * @return True if proxyable, false otherwise
-    */
-   public static boolean apiTypesAreProxyable(Set<Type> types)
-   {
-      for (Type apiType : types)
-      {
-         if (Object.class.equals(apiType))
-         {
-            continue;
-         }
-         if (!Proxies.isTypeProxyable(apiType))
-         {
-            return false;
-         }
-      }
-      return true;
-   }
-   
    public static Set<FieldInjectionPoint<?>> getFieldInjectionPoints(AnnotatedClass<?> annotatedItem, Bean<?> declaringBean)
    {
       Set<FieldInjectionPoint<?>> injectableFields = new HashSet<FieldInjectionPoint<?>>();

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Names.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Names.java	2009-03-12 16:51:55 UTC (rev 1944)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Names.java	2009-03-12 16:53:48 UTC (rev 1945)
@@ -288,7 +288,7 @@
       return buffer.toString();
    }
    
-   public static String typesToString(Set<Type> types)
+   public static String typesToString(Set<? extends Type> types)
    {
       StringBuilder buffer = new StringBuilder();
       int i = 0;

Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Proxies.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Proxies.java	2009-03-12 16:51:55 UTC (rev 1944)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/util/Proxies.java	2009-03-12 16:53:48 UTC (rev 1945)
@@ -101,7 +101,7 @@
          }
       }
 
-      public static TypeInfo ofTypes(Set<Type> types)
+      public static TypeInfo ofTypes(Set<? extends Type> types)
       {
          TypeInfo typeInfo = new TypeInfo();
          for (Type type : types)
@@ -157,6 +157,29 @@
       }
       return false;
    }
+   
+
+   /**
+    * Indicates if a set of types are all proxyable
+    * 
+    * @param types The types to test
+    * @return True if proxyable, false otherwise
+    */
+   public static boolean isTypesProxyable(Iterable<? extends Type> types)
+   {
+      for (Type apiType : types)
+      {
+         if (Object.class.equals(apiType))
+         {
+            continue;
+         }
+         if (!isTypeProxyable(apiType))
+         {
+            return false;
+         }
+      }
+      return true;
+   }
       
    private static boolean isClassProxyable(Class<?> clazz)
    {
@@ -186,4 +209,5 @@
       }
    }
 
+
 }




More information about the weld-commits mailing list