[webbeans-commits] Webbeans SVN: r18 - in ri/trunk/webbeans-api/src/main: resources and 1 other directory.
webbeans-commits at lists.jboss.org
webbeans-commits at lists.jboss.org
Fri Jun 27 10:12:41 EDT 2008
Author: pete.muir at jboss.org
Date: 2008-06-27 10:12:41 -0400 (Fri, 27 Jun 2008)
New Revision: 18
Modified:
ri/trunk/webbeans-api/src/main/java/javax/webbeans/DynamicBinding.java
ri/trunk/webbeans-api/src/main/resources/web-beans.xsd
Log:
Fix dynamicbinding to correctly interpret super class types
Modified: ri/trunk/webbeans-api/src/main/java/javax/webbeans/DynamicBinding.java
===================================================================
--- ri/trunk/webbeans-api/src/main/java/javax/webbeans/DynamicBinding.java 2008-06-26 18:53:21 UTC (rev 17)
+++ ri/trunk/webbeans-api/src/main/java/javax/webbeans/DynamicBinding.java 2008-06-27 14:12:41 UTC (rev 18)
@@ -12,7 +12,17 @@
@SuppressWarnings("unchecked")
public DynamicBinding()
{
- Type type = getClass().getGenericSuperclass();
+ annotationType = getAnnotationType(getClass());
+ if (annotationType == null)
+ {
+ throw new RuntimeException("Unable to determine type of dynamic binding for " + getClass());
+ }
+ }
+
+ private static <T> Class<T> getAnnotationType(Class<?> clazz)
+ {
+ Type type = clazz.getGenericSuperclass();
+ Class<T> annotationType = null;
if (type instanceof ParameterizedType)
{
ParameterizedType parameterizedType = (ParameterizedType) type;
@@ -21,10 +31,14 @@
annotationType = (Class<T>) parameterizedType.getActualTypeArguments()[0];
}
}
- if (annotationType == null)
+ if (annotationType == null && clazz != Object.class)
{
- throw new RuntimeException("Unable to determine type of dynamic binding");
+ return getAnnotationType(clazz.getSuperclass());
}
+ else
+ {
+ return annotationType;
+ }
}
public Class<? extends Annotation> annotationType()
Modified: ri/trunk/webbeans-api/src/main/resources/web-beans.xsd
===================================================================
--- ri/trunk/webbeans-api/src/main/resources/web-beans.xsd 2008-06-26 18:53:21 UTC (rev 17)
+++ ri/trunk/webbeans-api/src/main/resources/web-beans.xsd 2008-06-27 14:12:41 UTC (rev 18)
@@ -25,7 +25,7 @@
<xs:element ref="web-beans:binding" />
<xs:element ref="web-beans:scope" />
<xs:element ref="web-beans:named" />
- <xs:element ref="web-beans:stereotype" />
+ <xs:element ref="web-beans:stereotype" maxOccurs="unbounded"/>
<xs:element ref="web-beans:producer-method" />
<xs:element ref="web-beans:producer-type" />
<xs:element ref="web-beans:remote" />
More information about the weld-commits
mailing list