[webbeans-commits] Webbeans SVN: r23 - ri/trunk/webbeans-api/src/main/java/javax/webbeans.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Mon Jun 30 18:45:49 EDT 2008


Author: pete.muir at jboss.org
Date: 2008-06-30 18:45:49 -0400 (Mon, 30 Jun 2008)
New Revision: 23

Modified:
   ri/trunk/webbeans-api/src/main/java/javax/webbeans/DynamicBinding.java
Log:
Do this lazily (nicer for enhancer)

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-30 22:45:18 UTC (rev 22)
+++ ri/trunk/webbeans-api/src/main/java/javax/webbeans/DynamicBinding.java	2008-06-30 22:45:49 UTC (rev 23)
@@ -9,18 +9,9 @@
 
    private Class<T> annotationType;
    
-   @SuppressWarnings("unchecked")
-   public DynamicBinding()
-   {
-      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)
@@ -43,6 +34,11 @@
    
    public Class<? extends Annotation> annotationType()
    {
+      annotationType = getAnnotationType(getClass());
+      if (annotationType == null)
+      {
+         throw new RuntimeException("Unable to determine type of dynamic binding for " + getClass());
+      }
       return annotationType;
    }
    
@@ -50,7 +46,7 @@
    public String toString()
    {
       // TODO Make this closer to the spec for Annotation
-      String annotationName = "@" + annotationType.getName();
+      String annotationName = "@" + annotationType().getName();
       return annotationName;
    }
    




More information about the weld-commits mailing list