velocity-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nbu...@apache.org
Subject svn commit: r538988 - in /velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools: OldToolInfo.java ToolInfo.java
Date Thu, 17 May 2007 16:04:06 GMT
Author: nbubna
Date: Thu May 17 09:04:05 2007
New Revision: 538988

URL: http://svn.apache.org/viewvc?view=rev&rev=538988
Log:
move invoke() to ToolInfo where it can be used to call configure() also

Modified:
    velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/OldToolInfo.java
    velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/ToolInfo.java

Modified: velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/OldToolInfo.java
URL: http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/OldToolInfo.java?view=diff&rev=538988&r1=538987&r2=538988
==============================================================================
--- velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/OldToolInfo.java (original)
+++ velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/OldToolInfo.java Thu
May 17 09:04:05 2007
@@ -90,27 +90,4 @@
         return tool;
     }
 
-    protected void invoke(Method method, Object tool, Object param)
-    {
-        try
-        {
-            // call the setup method on the instance
-            method.invoke(tool, new Object[]{ param });
-        }
-        catch (IllegalAccessException iae)
-        {
-            String msg = "Unable to invoke " +
-                         method.getName()+" on "+tool;
-            // restricting access to this method by this class ist verboten
-            throw new IllegalStateException(msg, iae);
-        }
-        catch (InvocationTargetException ite)
-        {
-            String msg = "Exception when invoking " +
-                         method.getName()+" on "+tool;
-            // convert to a runtime exception, and re-throw
-            throw new RuntimeException(msg, ite.getCause());
-        }
-    }
-
 }

Modified: velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/ToolInfo.java
URL: http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/ToolInfo.java?view=diff&rev=538988&r1=538987&r2=538988
==============================================================================
--- velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/ToolInfo.java (original)
+++ velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/ToolInfo.java Thu
May 17 09:04:05 2007
@@ -254,7 +254,7 @@
         {
             if (combinedProps != null)
             {
-                configure(tool, combinedProps);
+                invoke(this.configure, tool, combinedProps);
             }
         }
 
@@ -294,28 +294,29 @@
     }
 
 
-    protected void configure(Object tool, Map<String,Object> properties)
+    protected void invoke(Method method, Object tool, Object param)
     {
         try
         {
-            // call the configure method on the instance
-            configure.invoke(tool, new Object[]{ properties });
+            // call the setup method on the instance
+            method.invoke(tool, new Object[]{ param });
         }
         catch (IllegalAccessException iae)
         {
             String msg = "Unable to invoke " +
-                         CONFIGURE_METHOD_NAME + "(Map) on "+tool;
+                         method + " on " + tool;
             // restricting access to this method by this class ist verboten
             throw new IllegalStateException(msg, iae);
         }
         catch (InvocationTargetException ite)
         {
             String msg = "Exception when invoking " +
-                         CONFIGURE_METHOD_NAME + "(Map) on "+tool;
+                         method + " on " + tool;
             // convert to a runtime exception, and re-throw
             throw new RuntimeException(msg, ite.getCause());
         }
     }
+
 
     protected void setProperty(Object tool, String name, Object value)
     {



Mime
View raw message