velocity-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nbu...@apache.org
Subject svn commit: r533282 - /velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/config/ToolConfiguration.java
Date Sat, 28 Apr 2007 03:28:45 GMT
Author: nbubna
Date: Fri Apr 27 20:28:44 2007
New Revision: 533282

URL: http://svn.apache.org/viewvc?view=rev&rev=533282
Log:
change setClass() to take Class and don't try to look up annotations when the class is null

Modified:
    velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/config/ToolConfiguration.java

Modified: velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/config/ToolConfiguration.java
URL: http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/config/ToolConfiguration.java?view=diff&rev=533282&r1=533281&r2=533282
==============================================================================
--- velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/config/ToolConfiguration.java
(original)
+++ velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/config/ToolConfiguration.java
Fri Apr 27 20:28:44 2007
@@ -43,14 +43,14 @@
      * This doesn't take a {@link Class} parameter because
      * this class was not created for all-java configuration.
      */
-    public void setClass(String classname)
+    public void setClass(Class clazz)
     {
-        this.classname = classname;
+        this.classname = clazz.getName();
     }
 
     public void setClassname(String classname)
     {
-        setClass(classname);
+        this.classname = classname;
     }
 
     public void setRestrictTo(String path)
@@ -65,11 +65,14 @@
             return this.key;
         }
 
-        DefaultKey defaultKey = 
-            (DefaultKey)getToolClass().getAnnotation(DefaultKey.class);
-        if (defaultKey != null)
+        if (getClassname() != null)
         {
-            return defaultKey.value();
+            DefaultKey defaultKey = 
+                (DefaultKey)getToolClass().getAnnotation(DefaultKey.class);
+            if (defaultKey != null)
+            {
+                return defaultKey.value();
+            }
         }
         return null;
     }



Mime
View raw message