commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Janek Bogucki" <janekbogu...@hotmail.com>
Subject [DIGESTER] Patch for SetTopRule.java,v 1.10
Date Sat, 19 Jan 2002 00:05:15 GMT
Hi,

This patch is for SetTopRule.java,v 1.10. It's essentially a clarification 
to the
API documentation although it includes edits on the end() method. The edit 
on this
method is to swap the names of the variables 'parent' and 'child' to match 
the roles
of these variables have. It also corrects a misleading diagnostic message.

The code change is covered by two tests already in RuleTestCase.java,v 1.8.

If someone has the time would they consider applying this patch?

Many Thanks,
Janek

--- SetTopRule.java-1.10	Fri Jan 18 23:09:36 2002
+++ SetTopRule.java	Fri Jan 18 23:33:34 2002
@@ -71,8 +71,8 @@


/**
- * Rule implementation that calls a method on the top (parent)
- * object, passing the (top-1) (child) object as an argument.
+ * Rule implementation that calls a method on the top (child)
+ * object, passing the (top-1) (parent) object as an argument.
  *
  * @author Craig McClanahan
  * @author Scott Sanders
@@ -87,11 +87,11 @@

     /**
      * Construct a "set parent" rule with the specified method name.  The
-     * parent method's argument type is assumed to be the class of the
+     * "set parent" method's argument type is assumed to be the class of 
the
      * child object.
      *
      * @param digester The associated Digester
-     * @param methodName Method name of the parent method to call
+     * @param methodName Method name of the "set parent" method to call
      */
     public SetTopRule(Digester digester, String methodName) {

@@ -104,8 +104,8 @@
      * Construct a "set parent" rule with the specified method name.
      *
      * @param digester The associated Digester
-     * @param methodName Method name of the parent method to call
-     * @param paramType Java class of the parent method's argument
+     * @param methodName Method name of the "set parent" method to call
+     * @param paramType Java class of the "set parent" method's argument
      *  (if you wish to use a primitive type, specify the corresonding
      *  Java wrapper class instead, such as <code>java.lang.Boolean</code>
      *  for a <code>boolean</code> parameter)
@@ -124,7 +124,7 @@


     /**
-     * The method name to call on the parent object.
+     * The method name to call on the child object.
      */
     protected String methodName = null;

@@ -144,15 +144,15 @@
     public void end() throws Exception {

         // Identify the objects to be used
-        Object child = digester.peek(1);
-        Object parent = digester.peek(0);
+        Object child = digester.peek(0);
+        Object parent = digester.peek(1);
         if (digester.log.isDebugEnabled()) {
-            if (parent == null) {
-                digester.log.debug("Call [NULL PARENT]." +
-                        methodName + "(" + child + ")");
+            if (child == null) {
+                digester.log.debug("Call [NULL CHILD]." +
+                        methodName + "(" + parent + ")");
             } else {
-                digester.log.debug("Call " + parent.getClass().getName() + 
"." +
-                        methodName + "(" + child + ")");
+                digester.log.debug("Call " + child.getClass().getName() + 
"." +
+                        methodName + "(" + parent + ")");
             }
         }

@@ -162,10 +162,10 @@
             paramTypes[0] =
                     digester.getClassLoader().loadClass(paramType);
         } else {
-            paramTypes[0] = child.getClass();
+            paramTypes[0] = parent.getClass();
         }
-        MethodUtils.invokeExactMethod(parent, methodName,
-                new Object[]{ child }, paramTypes);
+        MethodUtils.invokeExactMethod(child, methodName,
+                new Object[]{ parent }, paramTypes);

     }



_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com


--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message