commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1102402 [6/20] - in /commons/sandbox/digester3/trunk/src: main/java/org/apache/commons/digester3/ main/java/org/apache/commons/digester3/annotations/ main/java/org/apache/commons/digester3/annotations/handlers/ main/java/org/apache/commons...
Date Thu, 12 May 2011 18:03:33 GMT
Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/SetNestedPropertiesRule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/SetNestedPropertiesRule.java?rev=1102402&r1=1102401&r2=1102402&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/SetNestedPropertiesRule.java (original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/SetNestedPropertiesRule.java Thu May 12 18:03:26 2011
@@ -16,10 +16,8 @@
  * limitations under the License.
  */
 
-
 package org.apache.commons.digester3;
 
-
 import java.util.List;
 import java.util.LinkedList;
 import java.util.ArrayList;
@@ -35,13 +33,15 @@ import org.xml.sax.Attributes;
 
 import org.apache.commons.logging.Log;
 
-
 /**
- * <p>Rule implementation that sets properties on the object at the top of the
- * stack, based on child elements with names matching properties on that 
- * object.</p>
- *
- * <p>Example input that can be processed by this rule:</p>
+ * <p>
+ * Rule implementation that sets properties on the object at the top of the stack, based on child elements with names
+ * matching properties on that object.
+ * </p>
+ * <p>
+ * Example input that can be processed by this rule:
+ * </p>
+ * 
  * <pre>
  *   [widget]
  *    [height]7[/height]
@@ -49,289 +49,320 @@ import org.apache.commons.logging.Log;
  *    [label]Hello, world[/label]
  *   [/widget]
  * </pre>
- *
- * <p>For each child element of [widget], a corresponding setter method is 
- * located on the object on the top of the digester stack, the body text of
- * the child element is converted to the type specified for the (sole) 
- * parameter to the setter method, then the setter method is invoked.</p>
- *
- * <p>This rule supports custom mapping of xml element names to property names.
- * The default mapping for particular elements can be overridden by using 
- * {@link #SetNestedPropertiesRule(String[] elementNames,
- *                                 String[] propertyNames)}.
- * This allows child elements to be mapped to properties with different names.
- * Certain elements can also be marked to be ignored.</p>
- *
- * <p>A very similar effect can be achieved using a combination of the 
- * <code>BeanPropertySetterRule</code> and the <code>ExtendedBaseRules</code> 
- * rules manager; this <code>Rule</code>, however, works fine with the default 
- * <code>RulesBase</code> rules manager.</p>
- *
- * <p>Note that this rule is designed to be used to set only "primitive"
- * bean properties, eg String, int, boolean. If some of the child xml elements
- * match ObjectCreateRule rules (ie cause objects to be created) then you must
- * use one of the more complex constructors to this rule to explicitly skip
- * processing of that xml element, and define a SetNextRule (or equivalent) to
- * handle assigning the child object to the appropriate property instead.</p>
- *
- * <p><b>Implementation Notes</b></p>
- *
- * <p>This class works by creating its own simple Rules implementation. When
- * begin is invoked on this rule, the digester's current rules object is
- * replaced by a custom one. When end is invoked for this rule, the original
- * rules object is restored. The digester rules objects therefore behave in
- * a stack-like manner.</p>
- *
- * <p>For each child element encountered, the custom Rules implementation
- * ensures that a special AnyChildRule instance is included in the matches 
- * returned to the digester, and it is this rule instance that is responsible 
- * for setting the appropriate property on the target object (if such a property 
- * exists). The effect is therefore like a "trailing wildcard pattern". The 
- * custom Rules implementation also returns the matches provided by the 
- * underlying Rules implementation for the same pattern, so other rules
- * are not "disabled" during processing of a SetNestedPropertiesRule.</p> 
- *
- * <p>TODO: Optimise this class. Currently, each time begin is called,
- * new AnyChildRules and AnyChildRule objects are created. It should be
- * possible to cache these in normal use (though watch out for when a rule
- * instance is invoked re-entrantly!).</p>
- *
+ * <p>
+ * For each child element of [widget], a corresponding setter method is located on the object on the top of the digester
+ * stack, the body text of the child element is converted to the type specified for the (sole) parameter to the setter
+ * method, then the setter method is invoked.
+ * </p>
+ * <p>
+ * This rule supports custom mapping of xml element names to property names. The default mapping for particular elements
+ * can be overridden by using {@link #SetNestedPropertiesRule(String[] elementNames, String[] propertyNames)}. This
+ * allows child elements to be mapped to properties with different names. Certain elements can also be marked to be
+ * ignored.
+ * </p>
+ * <p>
+ * A very similar effect can be achieved using a combination of the <code>BeanPropertySetterRule</code> and the
+ * <code>ExtendedBaseRules</code> rules manager; this <code>Rule</code>, however, works fine with the default
+ * <code>RulesBase</code> rules manager.
+ * </p>
+ * <p>
+ * Note that this rule is designed to be used to set only "primitive" bean properties, eg String, int, boolean. If some
+ * of the child xml elements match ObjectCreateRule rules (ie cause objects to be created) then you must use one of the
+ * more complex constructors to this rule to explicitly skip processing of that xml element, and define a SetNextRule
+ * (or equivalent) to handle assigning the child object to the appropriate property instead.
+ * </p>
+ * <p>
+ * <b>Implementation Notes</b>
+ * </p>
+ * <p>
+ * This class works by creating its own simple Rules implementation. When begin is invoked on this rule, the digester's
+ * current rules object is replaced by a custom one. When end is invoked for this rule, the original rules object is
+ * restored. The digester rules objects therefore behave in a stack-like manner.
+ * </p>
+ * <p>
+ * For each child element encountered, the custom Rules implementation ensures that a special AnyChildRule instance is
+ * included in the matches returned to the digester, and it is this rule instance that is responsible for setting the
+ * appropriate property on the target object (if such a property exists). The effect is therefore like a
+ * "trailing wildcard pattern". The custom Rules implementation also returns the matches provided by the underlying
+ * Rules implementation for the same pattern, so other rules are not "disabled" during processing of a
+ * SetNestedPropertiesRule.
+ * </p>
+ * <p>
+ * TODO: Optimise this class. Currently, each time begin is called, new AnyChildRules and AnyChildRule objects are
+ * created. It should be possible to cache these in normal use (though watch out for when a rule instance is invoked
+ * re-entrantly!).
+ * </p>
+ * 
  * @since 1.6
  */
 
-public class SetNestedPropertiesRule extends Rule {
+public class SetNestedPropertiesRule
+    extends Rule
+{
 
     private Log log = null;
-    
+
     private boolean trimData = true;
+
     private boolean allowUnknownChildElements = false;
-    
+
     private HashMap<String, String> elementNames = new HashMap<String, String>();
 
     // ----------------------------------------------------------- Constructors
 
     /**
-     * Base constructor, which maps every child element into a bean property
-     * with the same name as the xml element.
-     *
-     * <p>It is an error if a child xml element exists but the target java 
-     * bean has no such property (unless setAllowUnknownChildElements has been
-     * set to true).</p>
+     * Base constructor, which maps every child element into a bean property with the same name as the xml element.
+     * <p>
+     * It is an error if a child xml element exists but the target java bean has no such property (unless
+     * setAllowUnknownChildElements has been set to true).
+     * </p>
      */
-    public SetNestedPropertiesRule() {
-        // nothing to set up 
+    public SetNestedPropertiesRule()
+    {
+        // nothing to set up
     }
-    
-    /** 
-     * <p>Convenience constructor which overrides the default mappings for 
-     * just one property.</p>
-     *
-     * <p>For details about how this works, see
-     * {@link #SetNestedPropertiesRule(String[] elementNames, 
-     * String[] propertyNames)}.</p>
-     *
-     * @param elementName is the child xml element to match 
-     * @param propertyName is the java bean property to be assigned the value 
-     * of the specified xml element. This may be null, in which case the 
-     * specified xml element will be ignored.
+
+    /**
+     * <p>
+     * Convenience constructor which overrides the default mappings for just one property.
+     * </p>
+     * <p>
+     * For details about how this works, see
+     * {@link #SetNestedPropertiesRule(String[] elementNames, String[] propertyNames)}.
+     * </p>
+     * 
+     * @param elementName is the child xml element to match
+     * @param propertyName is the java bean property to be assigned the value of the specified xml element. This may be
+     *            null, in which case the specified xml element will be ignored.
      */
-    public SetNestedPropertiesRule(String elementName, String propertyName) {
-        elementNames.put(elementName, propertyName);
+    public SetNestedPropertiesRule( String elementName, String propertyName )
+    {
+        elementNames.put( elementName, propertyName );
     }
-    
-    /** 
-     * <p>Constructor which allows element->property mapping to be overridden.
+
+    /**
+     * <p>
+     * Constructor which allows element->property mapping to be overridden.
+     * </p>
+     * <p>
+     * Two arrays are passed in. One contains xml element names and the other java bean property names. The element name
+     * / property name pairs are matched by position; in order words, the first string in the element name array
+     * corresponds to the first string in the property name array and so on.
+     * </p>
+     * <p>
+     * If a property name is null or the xml element name has no matching property name due to the arrays being of
+     * different lengths then this indicates that the xml element should be ignored.
      * </p>
-     *
-     * <p>Two arrays are passed in. One contains xml element names and the 
-     * other java bean property names. The element name / property name pairs
-     * are matched by position; in order words, the first string in the element
-     * name array corresponds to the first string in the property name array 
-     * and so on.</p>
-     *
-     * <p>If a property name is null or the xml element name has no matching
-     * property name due to the arrays being of different lengths then this
-     * indicates that the xml element should be ignored.</p>
-     * 
      * <h5>Example One</h5>
-     * <p> The following constructs a rule that maps the <code>alt-city</code>
-     * element to the <code>city</code> property and the <code>alt-state</code>
-     * to the <code>state</code> property. All other child elements are mapped
-     * as usual using exact name matching.
-     * <code><pre>
+     * <p>
+     * The following constructs a rule that maps the <code>alt-city</code> element to the <code>city</code> property and
+     * the <code>alt-state</code> to the <code>state</code> property. All other child elements are mapped as usual using
+     * exact name matching. <code><pre>
      *      SetNestedPropertiesRule(
      *                new String[] {"alt-city", "alt-state"}, 
      *                new String[] {"city", "state"});
      * </pre></code>
      * </p>
-     *
      * <h5>Example Two</h5>
-     * <p> The following constructs a rule that maps the <code>class</code>
-     * xml element to the <code>className</code> property. The xml element 
-     * <code>ignore-me</code> is not mapped, ie is ignored. All other elements 
-     * are mapped as usual using exact name matching.
-     * <code><pre>
+     * <p>
+     * The following constructs a rule that maps the <code>class</code> xml element to the <code>className</code>
+     * property. The xml element <code>ignore-me</code> is not mapped, ie is ignored. All other elements are mapped as
+     * usual using exact name matching. <code><pre>
      *      SetPropertiesRule(
      *                new String[] {"class", "ignore-me"}, 
      *                new String[] {"className"});
      * </pre></code>
      * </p>
-     *
+     * 
      * @param elementNames names of elements to map
      * @param propertyNames names of properties mapped to
      */
-    public SetNestedPropertiesRule(String[] elementNames, String[] propertyNames) {
-        for (int i=0, size=elementNames.length; i<size; i++) {
+    public SetNestedPropertiesRule( String[] elementNames, String[] propertyNames )
+    {
+        for ( int i = 0, size = elementNames.length; i < size; i++ )
+        {
             String propName = null;
-            if (i < propertyNames.length) {
+            if ( i < propertyNames.length )
+            {
                 propName = propertyNames[i];
             }
-            
-            this.elementNames.put(elementNames[i], propName);
+
+            this.elementNames.put( elementNames[i], propName );
         }
     }
-        
+
     // --------------------------------------------------------- Public Methods
 
     /** Invoked when rule is added to digester. */
     @Override
-    public void setDigester(Digester digester) {
-        super.setDigester(digester);
+    public void setDigester( Digester digester )
+    {
+        super.setDigester( digester );
         log = digester.getLogger();
     }
-    
+
     /**
-     * When set to true, any text within child elements will have leading
-     * and trailing whitespace removed before assignment to the target
-     * object. The default value for this attribute is true.
+     * When set to true, any text within child elements will have leading and trailing whitespace removed before
+     * assignment to the target object. The default value for this attribute is true.
      */
-    public void setTrimData(boolean trimData) {
+    public void setTrimData( boolean trimData )
+    {
         this.trimData = trimData;
     }
-    
+
     /** See {@link #setTrimData}. */
-     public boolean getTrimData() {
+    public boolean getTrimData()
+    {
         return trimData;
     }
-    
+
     /**
-     * Determines whether an error is reported when a nested element is
-     * encountered for which there is no corresponding property-setter
-     * method.
+     * Determines whether an error is reported when a nested element is encountered for which there is no corresponding
+     * property-setter method.
      * <p>
-     * When set to false, any child element for which there is no
-     * corresponding object property will cause an error to be reported.
+     * When set to false, any child element for which there is no corresponding object property will cause an error to
+     * be reported.
      * <p>
-     * When set to true, any child element for which there is no
-     * corresponding object property will simply be ignored.
+     * When set to true, any child element for which there is no corresponding object property will simply be ignored.
      * <p>
-     * The default value of this attribute is false (unknown child elements
-     * are not allowed).
+     * The default value of this attribute is false (unknown child elements are not allowed).
      */
-    public void setAllowUnknownChildElements(boolean allowUnknownChildElements) {
+    public void setAllowUnknownChildElements( boolean allowUnknownChildElements )
+    {
         this.allowUnknownChildElements = allowUnknownChildElements;
     }
-    
+
     /** See {@link #setAllowUnknownChildElements}. */
-     public boolean getAllowUnknownChildElements() {
+    public boolean getAllowUnknownChildElements()
+    {
         return allowUnknownChildElements;
     }
-    
+
     /**
      * Process the beginning of this element.
-     *
+     * 
      * @param namespace is the namespace this attribute is in, or null
      * @param name is the name of the current xml element
      * @param attributes is the attribute list of this element
      */
     @Override
-    public void begin(String namespace, String name, Attributes attributes) 
-                      throws Exception {
+    public void begin( String namespace, String name, Attributes attributes )
+        throws Exception
+    {
         Rules oldRules = getDigester().getRules();
         AnyChildRule anyChildRule = new AnyChildRule();
-        anyChildRule.setDigester(getDigester());
-        AnyChildRules newRules = new AnyChildRules(anyChildRule);
-        newRules.init(getDigester().getMatch()+"/", oldRules);
-        getDigester().setRules(newRules);
+        anyChildRule.setDigester( getDigester() );
+        AnyChildRules newRules = new AnyChildRules( anyChildRule );
+        newRules.init( getDigester().getMatch() + "/", oldRules );
+        getDigester().setRules( newRules );
     }
-    
+
     /**
-     * This is only invoked after all child elements have been processed,
-     * so we can remove the custom Rules object that does the 
-     * child-element-matching.
+     * This is only invoked after all child elements have been processed, so we can remove the custom Rules object that
+     * does the child-element-matching.
      */
     @Override
-    public void body(String namespace, String name, String text) throws Exception {
+    public void body( String namespace, String name, String text )
+        throws Exception
+    {
         AnyChildRules newRules = (AnyChildRules) getDigester().getRules();
-        getDigester().setRules(newRules.getOldRules());
+        getDigester().setRules( newRules.getOldRules() );
     }
 
     /**
      * Add an additional custom xml-element -> property mapping.
      * <p>
-     * This is primarily intended to be used from the xml rules module
-     * (as it is not possible there to pass the necessary parameters to the
-     * constructor for this class). However it is valid to use this method
-     * directly if desired.
+     * This is primarily intended to be used from the xml rules module (as it is not possible there to pass the
+     * necessary parameters to the constructor for this class). However it is valid to use this method directly if
+     * desired.
      */
-    public void addAlias(String elementName, String propertyName) {
-        elementNames.put(elementName, propertyName);
+    public void addAlias( String elementName, String propertyName )
+    {
+        elementNames.put( elementName, propertyName );
     }
-  
+
     /**
      * Render a printable version of this Rule.
      */
     @Override
-    public String toString() {
-        StringBuilder sb = new StringBuilder("SetNestedPropertiesRule[");
-        sb.append("allowUnknownChildElements=");
-        sb.append(allowUnknownChildElements);
-        sb.append(", trimData=");
-        sb.append(trimData);
-        sb.append(", elementNames=");
-        sb.append(elementNames);
-        sb.append("]");
-        return sb.toString();    
+    public String toString()
+    {
+        StringBuilder sb = new StringBuilder( "SetNestedPropertiesRule[" );
+        sb.append( "allowUnknownChildElements=" );
+        sb.append( allowUnknownChildElements );
+        sb.append( ", trimData=" );
+        sb.append( trimData );
+        sb.append( ", elementNames=" );
+        sb.append( elementNames );
+        sb.append( "]" );
+        return sb.toString();
     }
 
-    //----------------------------------------- local classes 
+    // ----------------------------------------- local classes
 
     /** Private Rules implementation */
-    private class AnyChildRules implements Rules {
+    private class AnyChildRules
+        implements Rules
+    {
         private String matchPrefix = null;
+
         private Rules decoratedRules = null;
-        
-        private ArrayList<Rule> rules = new ArrayList<Rule>(1);
+
+        private ArrayList<Rule> rules = new ArrayList<Rule>( 1 );
+
         private AnyChildRule rule;
-        
-        public AnyChildRules(AnyChildRule rule) {
+
+        public AnyChildRules( AnyChildRule rule )
+        {
             this.rule = rule;
-            rules.add(rule); 
+            rules.add( rule );
         }
-        
-        public Digester getDigester() { return null; }
-        public void setDigester(Digester digester) {}
-        public String getNamespaceURI() {return null;}
-        public void setNamespaceURI(String namespaceURI) {}
-        public void add(String pattern, Rule rule) {}
-        public void clear() {}
-        
-        public List<Rule> match(String matchPath) { 
-            return match(null,matchPath); 
-        }
-        
-        public List<Rule> match(String namespaceURI, String matchPath) {
-            List<Rule> match = decoratedRules.match(namespaceURI, matchPath);
-            
-            if ((matchPath.startsWith(matchPrefix)) &&
-                (matchPath.indexOf('/', matchPrefix.length()) == -1)) {
-                    
+
+        public Digester getDigester()
+        {
+            return null;
+        }
+
+        public void setDigester( Digester digester )
+        {
+        }
+
+        public String getNamespaceURI()
+        {
+            return null;
+        }
+
+        public void setNamespaceURI( String namespaceURI )
+        {
+        }
+
+        public void add( String pattern, Rule rule )
+        {
+        }
+
+        public void clear()
+        {
+        }
+
+        public List<Rule> match( String matchPath )
+        {
+            return match( null, matchPath );
+        }
+
+        public List<Rule> match( String namespaceURI, String matchPath )
+        {
+            List<Rule> match = decoratedRules.match( namespaceURI, matchPath );
+
+            if ( ( matchPath.startsWith( matchPrefix ) ) && ( matchPath.indexOf( '/', matchPrefix.length() ) == -1 ) )
+            {
+
                 // The current element is a direct child of the element
                 // specified in the init method, so we want to ensure that
                 // the rule passed to this object's constructor is included
                 // in the returned list of matching rules.
-                
-                if ((match == null || match.size()==0)) {
+
+                if ( ( match == null || match.size() == 0 ) )
+                {
                     // The "real" rules class doesn't have any matches for
                     // the specified path, so we return a list containing
                     // just one rule: the one passed to this object's
@@ -344,14 +375,15 @@ public class SetNestedPropertiesRule ext
                 //
                 // It might not be safe to modify the returned list,
                 // so clone it first.
-                LinkedList<Rule> newMatch = new LinkedList<Rule>(match);
-                newMatch.addLast(rule);
+                LinkedList<Rule> newMatch = new LinkedList<Rule>( match );
+                newMatch.addLast( rule );
                 return newMatch;
             }
             return match;
         }
-        
-        public List<Rule> rules() {
+
+        public List<Rule> rules()
+        {
             // This is not actually expected to be called during normal
             // processing.
             //
@@ -362,106 +394,123 @@ public class SetNestedPropertiesRule ext
             // method attempts to invoke the "finish" method for every Rule
             // instance - and thus needs to call rules() on its Rules object,
             // which is this one. Actually, java 1.5 and 1.6beta2 have a
-            // bug in their xml implementation such that endDocument is not 
+            // bug in their xml implementation such that endDocument is not
             // called after a SAXException, but other parsers (eg Aelfred)
             // do call endDocument. Here, we therefore need to return the
             // rules registered with the underlying Rules object.
-            log.debug("AnyChildRules.rules invoked.");
+            log.debug( "AnyChildRules.rules invoked." );
             return decoratedRules.rules();
         }
-        
-        public void init(String prefix, Rules rules) {
+
+        public void init( String prefix, Rules rules )
+        {
             matchPrefix = prefix;
             decoratedRules = rules;
         }
-        
-        public Rules getOldRules() {
+
+        public Rules getOldRules()
+        {
             return decoratedRules;
         }
     }
-    
-    private class AnyChildRule extends Rule {
+
+    private class AnyChildRule
+        extends Rule
+    {
         private String currChildNamespaceURI = null;
+
         private String currChildElementName = null;
-        
+
         @Override
-        public void begin(String namespaceURI, String name, 
-                              Attributes attributes) throws Exception {
-    
+        public void begin( String namespaceURI, String name, Attributes attributes )
+            throws Exception
+        {
+
             currChildNamespaceURI = namespaceURI;
             currChildElementName = name;
         }
-        
+
         @Override
-        public void body(String namespace, String name, String text) throws Exception {
+        public void body( String namespace, String name, String text )
+            throws Exception
+        {
             String propName = currChildElementName;
-            if (elementNames.containsKey(currChildElementName)) {
+            if ( elementNames.containsKey( currChildElementName ) )
+            {
                 // overide propName
-                propName = elementNames.get(currChildElementName);
-                if (propName == null) {
+                propName = elementNames.get( currChildElementName );
+                if ( propName == null )
+                {
                     // user wants us to ignore this element
                     return;
                 }
             }
-    
+
             boolean debug = log.isDebugEnabled();
 
-            if (debug) {
-                log.debug("[SetNestedPropertiesRule]{" + getDigester().getMatch() +
-                        "} Setting property '" + propName + "' to '" +
-                        text + "'");
+            if ( debug )
+            {
+                log.debug( "[SetNestedPropertiesRule]{" + getDigester().getMatch() + "} Setting property '" + propName
+                    + "' to '" + text + "'" );
             }
-    
+
             // Populate the corresponding properties of the top object
             Object top = getDigester().peek();
-            if (debug) {
-                if (top != null) {
-                    log.debug("[SetNestedPropertiesRule]{" + getDigester().getMatch() +
-                                       "} Set " + top.getClass().getName() +
-                                       " properties");
-                } else {
-                    log.debug("[SetPropertiesRule]{" + getDigester().getMatch() +
-                                       "} Set NULL properties");
+            if ( debug )
+            {
+                if ( top != null )
+                {
+                    log.debug( "[SetNestedPropertiesRule]{" + getDigester().getMatch() + "} Set "
+                        + top.getClass().getName() + " properties" );
+                }
+                else
+                {
+                    log.debug( "[SetPropertiesRule]{" + getDigester().getMatch() + "} Set NULL properties" );
                 }
             }
- 
-            if (trimData) {
+
+            if ( trimData )
+            {
                 text = text.trim();
             }
 
-            if (!allowUnknownChildElements) {
+            if ( !allowUnknownChildElements )
+            {
                 // Force an exception if the property does not exist
                 // (BeanUtils.setProperty() silently returns in this case)
-                if (top instanceof DynaBean) {
-                    DynaProperty desc =
-                        ((DynaBean) top).getDynaClass().getDynaProperty(propName);
-                    if (desc == null) {
-                        throw new NoSuchMethodException
-                            ("Bean has no property named " + propName);
+                if ( top instanceof DynaBean )
+                {
+                    DynaProperty desc = ( (DynaBean) top ).getDynaClass().getDynaProperty( propName );
+                    if ( desc == null )
+                    {
+                        throw new NoSuchMethodException( "Bean has no property named " + propName );
                     }
-                } else /* this is a standard JavaBean */ {
-                    PropertyDescriptor desc =
-                        PropertyUtils.getPropertyDescriptor(top, propName);
-                    if (desc == null) {
-                        throw new NoSuchMethodException
-                            ("Bean has no property named " + propName);
+                }
+                else
+                /* this is a standard JavaBean */{
+                    PropertyDescriptor desc = PropertyUtils.getPropertyDescriptor( top, propName );
+                    if ( desc == null )
+                    {
+                        throw new NoSuchMethodException( "Bean has no property named " + propName );
                     }
                 }
             }
-            
+
             try
             {
-            BeanUtils.setProperty(top, propName, text);
+                BeanUtils.setProperty( top, propName, text );
             }
-            catch(NullPointerException e) {
-                log.error("NullPointerException: "
-                 + "top=" + top + ",propName=" + propName + ",value=" + text + "!");
-                 throw e;
+            catch ( NullPointerException e )
+            {
+                log.error( "NullPointerException: " + "top=" + top + ",propName=" + propName + ",value=" + text + "!" );
+                throw e;
             }
         }
-    
+
         @Override
-        public void end(String namespace, String name) throws Exception {
+        public void end( String namespace, String name )
+            throws Exception
+        {
             currChildElementName = null;
         }
     }

Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/SetNextRule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/SetNextRule.java?rev=1102402&r1=1102401&r2=1102402&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/SetNextRule.java (original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/SetNextRule.java Thu May 12 18:03:26 2011
@@ -16,78 +16,69 @@
  * limitations under the License.
  */
 
-
 package org.apache.commons.digester3;
 
-
 import org.apache.commons.beanutils.MethodUtils;
 
-
 /**
- * <p>Rule implementation that calls a method on the (top-1) (parent)
- * object, passing the top object (child) as an argument.  It is
- * commonly used to establish parent-child relationships.</p>
- *
- * <p>This rule now supports more flexible method matching by default.
- * It is possible that this may break (some) code 
- * written against release 1.1.1 or earlier.
- * See {@link #isExactMatch()} for more details.</p> 
- *
- * <p>Note that while CallMethodRule uses commons-beanutils' data-conversion
- * functionality (ConvertUtils class) to convert parameter values into
- * the appropriate type for the parameter to the called method, this
- * rule does not. Needing to use ConvertUtils functionality when building
- * parent-child relationships is expected to be very rare; however if you 
- * do need this then instead of using this rule, create a CallMethodRule
- * specifying targetOffset of 1 in the constructor.</p>
+ * <p>
+ * Rule implementation that calls a method on the (top-1) (parent) object, passing the top object (child) as an
+ * argument. It is commonly used to establish parent-child relationships.
+ * </p>
+ * <p>
+ * This rule now supports more flexible method matching by default. It is possible that this may break (some) code
+ * written against release 1.1.1 or earlier. See {@link #isExactMatch()} for more details.
+ * </p>
+ * <p>
+ * Note that while CallMethodRule uses commons-beanutils' data-conversion functionality (ConvertUtils class) to convert
+ * parameter values into the appropriate type for the parameter to the called method, this rule does not. Needing to use
+ * ConvertUtils functionality when building parent-child relationships is expected to be very rare; however if you do
+ * need this then instead of using this rule, create a CallMethodRule specifying targetOffset of 1 in the constructor.
+ * </p>
  */
 
-public class SetNextRule extends Rule {
-
+public class SetNextRule
+    extends Rule
+{
 
     // ----------------------------------------------------------- Constructors
 
     /**
-     * Construct a "set next" rule with the specified method name.  The
-     * method's argument type is assumed to be the class of the
-     * child object.
-     *
+     * Construct a "set next" rule with the specified method name. The method's argument type is assumed to be the class
+     * of the child object.
+     * 
      * @param methodName Method name of the parent method to call
      */
-    public SetNextRule(String methodName) {
+    public SetNextRule( String methodName )
+    {
 
-        this(methodName, null);
+        this( methodName, null );
 
     }
 
-
     /**
      * Construct a "set next" rule with the specified method name.
-     *
+     * 
      * @param methodName Method name of the parent method to call
-     * @param paramType Java class of the 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)
+     * @param paramType Java class of the 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)
      */
-    public SetNextRule(String methodName,
-                       String paramType) {
+    public SetNextRule( String methodName, String paramType )
+    {
 
         this.methodName = methodName;
         this.paramType = paramType;
 
     }
 
-
     // ----------------------------------------------------- Instance Variables
 
-
     /**
      * The method name to call on the parent object.
      */
     protected String methodName = null;
 
-
     /**
      * The Java class name of the parameter type expected by the method.
      */
@@ -100,41 +91,47 @@ public class SetNextRule extends Rule {
 
     // --------------------------------------------------------- Public Methods
 
-
     /**
-     * <p>Is exact matching being used.</p>
-     *
-     * <p>This rule uses <code>org.apache.commons.beanutils.MethodUtils</code> 
-     * to introspect the relevent objects so that the right method can be called.
-     * Originally, <code>MethodUtils.invokeExactMethod</code> was used.
-     * This matches methods very strictly 
-     * and so may not find a matching method when one exists.
-     * This is still the behaviour when exact matching is enabled.</p>
-     *
-     * <p>When exact matching is disabled, <code>MethodUtils.invokeMethod</code> is used.
-     * This method finds more methods but is less precise when there are several methods 
-     * with correct signatures.
-     * So, if you want to choose an exact signature you might need to enable this property.</p>
-     *
-     * <p>The default setting is to disable exact matches.</p>
-     *
+     * <p>
+     * Is exact matching being used.
+     * </p>
+     * <p>
+     * This rule uses <code>org.apache.commons.beanutils.MethodUtils</code> to introspect the relevent objects so that
+     * the right method can be called. Originally, <code>MethodUtils.invokeExactMethod</code> was used. This matches
+     * methods very strictly and so may not find a matching method when one exists. This is still the behaviour when
+     * exact matching is enabled.
+     * </p>
+     * <p>
+     * When exact matching is disabled, <code>MethodUtils.invokeMethod</code> is used. This method finds more methods
+     * but is less precise when there are several methods with correct signatures. So, if you want to choose an exact
+     * signature you might need to enable this property.
+     * </p>
+     * <p>
+     * The default setting is to disable exact matches.
+     * </p>
+     * 
      * @return true iff exact matching is enabled
      * @since Digester Release 1.1.1
      */
-    public boolean isExactMatch() {
-    
+    public boolean isExactMatch()
+    {
+
         return useExactMatch;
     }
-    
+
     /**
-     * <p>Set whether exact matching is enabled.</p>
-     *
-     * <p>See {@link #isExactMatch()}.</p>
-     *
+     * <p>
+     * Set whether exact matching is enabled.
+     * </p>
+     * <p>
+     * See {@link #isExactMatch()}.
+     * </p>
+     * 
      * @param useExactMatch should this rule use exact method matching
      * @since Digester Release 1.1.1
-     */    
-    public void setExactMatch(boolean useExactMatch) {
+     */
+    public void setExactMatch( boolean useExactMatch )
+    {
 
         this.useExactMatch = useExactMatch;
     }
@@ -143,61 +140,68 @@ public class SetNextRule extends Rule {
      * Process the end of this element.
      */
     @Override
-    public void end(String namespace, String name) throws Exception {
+    public void end( String namespace, String name )
+        throws Exception
+    {
 
         // Identify the objects to be used
-        Object child = getDigester().peek(0);
-        Object parent = getDigester().peek(1);
-        if (getDigester().getLogger().isDebugEnabled()) {
-            if (parent == null) {
-                getDigester().getLogger().debug("[SetNextRule]{" + getDigester().getMatch() +
-                        "} Call [NULL PARENT]." +
-                        methodName + "(" + child + ")");
-            } else {
-                getDigester().getLogger().debug("[SetNextRule]{" + getDigester().getMatch() +
-                        "} Call " + parent.getClass().getName() + "." +
-                        methodName + "(" + child + ")");
+        Object child = getDigester().peek( 0 );
+        Object parent = getDigester().peek( 1 );
+        if ( getDigester().getLogger().isDebugEnabled() )
+        {
+            if ( parent == null )
+            {
+                getDigester().getLogger().debug( "[SetNextRule]{" + getDigester().getMatch() + "} Call [NULL PARENT]."
+                                                     + methodName + "(" + child + ")" );
+            }
+            else
+            {
+                getDigester().getLogger().debug( "[SetNextRule]{" + getDigester().getMatch() + "} Call "
+                                                     + parent.getClass().getName() + "." + methodName + "(" + child
+                                                     + ")" );
             }
         }
 
         // Call the specified method
         Class<?> paramTypes[] = new Class<?>[1];
-        if (paramType != null) {
-            paramTypes[0] =
-                    getDigester().getClassLoader().loadClass(paramType);
-        } else {
+        if ( paramType != null )
+        {
+            paramTypes[0] = getDigester().getClassLoader().loadClass( paramType );
+        }
+        else
+        {
             paramTypes[0] = child.getClass();
         }
-        
-        if (useExactMatch) {
-        
-            MethodUtils.invokeExactMethod(parent, methodName,
-                new Object[]{ child }, paramTypes);
-                
-        } else {
-        
-            MethodUtils.invokeMethod(parent, methodName,
-                new Object[]{ child }, paramTypes);
-        
+
+        if ( useExactMatch )
+        {
+
+            MethodUtils.invokeExactMethod( parent, methodName, new Object[] { child }, paramTypes );
+
         }
-    }
+        else
+        {
 
+            MethodUtils.invokeMethod( parent, methodName, new Object[] { child }, paramTypes );
+
+        }
+    }
 
     /**
      * Render a printable version of this Rule.
      */
     @Override
-    public String toString() {
+    public String toString()
+    {
 
-        StringBuilder sb = new StringBuilder("SetNextRule[");
-        sb.append("methodName=");
-        sb.append(methodName);
-        sb.append(", paramType=");
-        sb.append(paramType);
-        sb.append("]");
-        return (sb.toString());
+        StringBuilder sb = new StringBuilder( "SetNextRule[" );
+        sb.append( "methodName=" );
+        sb.append( methodName );
+        sb.append( ", paramType=" );
+        sb.append( paramType );
+        sb.append( "]" );
+        return ( sb.toString() );
 
     }
 
-
 }

Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/SetPropertiesRule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/SetPropertiesRule.java?rev=1102402&r1=1102401&r2=1102402&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/SetPropertiesRule.java (original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/SetPropertiesRule.java Thu May 12 18:03:26 2011
@@ -16,303 +16,329 @@
  * limitations under the License.
  */
 
-
 package org.apache.commons.digester3;
 
-
 import java.util.HashMap;
 
 import org.apache.commons.beanutils.BeanUtils;
 import org.apache.commons.beanutils.PropertyUtils;
 import org.xml.sax.Attributes;
 
-
 /**
- * <p>Rule implementation that sets properties on the object at the top of the
- * stack, based on attributes with corresponding names.</p>
- *
- * <p>This rule supports custom mapping of attribute names to property names.
- * The default mapping for particular attributes can be overridden by using 
- * {@link #SetPropertiesRule(String[] attributeNames, String[] propertyNames)}.
- * This allows attributes to be mapped to properties with different names.
- * Certain attributes can also be marked to be ignored.</p>
+ * <p>
+ * Rule implementation that sets properties on the object at the top of the stack, based on attributes with
+ * corresponding names.
+ * </p>
+ * <p>
+ * This rule supports custom mapping of attribute names to property names. The default mapping for particular attributes
+ * can be overridden by using {@link #SetPropertiesRule(String[] attributeNames, String[] propertyNames)}. This allows
+ * attributes to be mapped to properties with different names. Certain attributes can also be marked to be ignored.
+ * </p>
  */
 
-public class SetPropertiesRule extends Rule {
-
+public class SetPropertiesRule
+    extends Rule
+{
 
     // ----------------------------------------------------------- Constructors
 
     /**
      * Base constructor.
      */
-    public SetPropertiesRule() {
+    public SetPropertiesRule()
+    {
 
-        // nothing to set up 
+        // nothing to set up
 
     }
-    
-    /** 
-     * <p>Convenience constructor overrides the mapping for just one property.</p>
-     *
-     * <p>For details about how this works, see
-     * {@link #SetPropertiesRule(String[] attributeNames, String[] propertyNames)}.</p>
-     *
-     * @param attributeName map this attribute 
+
+    /**
+     * <p>
+     * Convenience constructor overrides the mapping for just one property.
+     * </p>
+     * <p>
+     * For details about how this works, see {@link #SetPropertiesRule(String[] attributeNames, String[] propertyNames)}
+     * .
+     * </p>
+     * 
+     * @param attributeName map this attribute
      * @param propertyName to a property with this name
      */
-    public SetPropertiesRule(String attributeName, String propertyName) {
-        
+    public SetPropertiesRule( String attributeName, String propertyName )
+    {
+
         attributeNames = new String[1];
         attributeNames[0] = attributeName;
         propertyNames = new String[1];
         propertyNames[0] = propertyName;
     }
-    
-    /** 
-     * <p>Constructor allows attribute->property mapping to be overriden.</p>
-     *
-     * <p>Two arrays are passed in. 
-     * One contains the attribute names and the other the property names.
-     * The attribute name / property name pairs are match by position
-     * In order words, the first string in the attribute name list matches
-     * to the first string in the property name list and so on.</p>
-     *
-     * <p>If a property name is null or the attribute name has no matching
-     * property name, then this indicates that the attibute should be ignored.</p>
-     * 
+
+    /**
+     * <p>
+     * Constructor allows attribute->property mapping to be overriden.
+     * </p>
+     * <p>
+     * Two arrays are passed in. One contains the attribute names and the other the property names. The attribute name /
+     * property name pairs are match by position In order words, the first string in the attribute name list matches to
+     * the first string in the property name list and so on.
+     * </p>
+     * <p>
+     * If a property name is null or the attribute name has no matching property name, then this indicates that the
+     * attibute should be ignored.
+     * </p>
      * <h5>Example One</h5>
-     * <p> The following constructs a rule that maps the <code>alt-city</code>
-     * attribute to the <code>city</code> property and the <code>alt-state</code>
-     * to the <code>state</code> property. 
-     * All other attributes are mapped as usual using exact name matching.
-     * <code><pre>
+     * <p>
+     * The following constructs a rule that maps the <code>alt-city</code> attribute to the <code>city</code> property
+     * and the <code>alt-state</code> to the <code>state</code> property. All other attributes are mapped as usual using
+     * exact name matching. <code><pre>
      *      SetPropertiesRule(
      *                new String[] {"alt-city", "alt-state"}, 
      *                new String[] {"city", "state"});
      * </pre></code>
-     *
      * <h5>Example Two</h5>
-     * <p> The following constructs a rule that maps the <code>class</code>
-     * attribute to the <code>className</code> property.
-     * The attribute <code>ignore-me</code> is not mapped.
-     * All other attributes are mapped as usual using exact name matching.
-     * <code><pre>
+     * <p>
+     * The following constructs a rule that maps the <code>class</code> attribute to the <code>className</code>
+     * property. The attribute <code>ignore-me</code> is not mapped. All other attributes are mapped as usual using
+     * exact name matching. <code><pre>
      *      SetPropertiesRule(
      *                new String[] {"class", "ignore-me"}, 
      *                new String[] {"className"});
      * </pre></code>
-     *
+     * 
      * @param attributeNames names of attributes to map
      * @param propertyNames names of properties mapped to
      */
-    public SetPropertiesRule(String[] attributeNames, String[] propertyNames) {
+    public SetPropertiesRule( String[] attributeNames, String[] propertyNames )
+    {
         // create local copies
         this.attributeNames = new String[attributeNames.length];
-        for (int i=0, size=attributeNames.length; i<size; i++) {
+        for ( int i = 0, size = attributeNames.length; i < size; i++ )
+        {
             this.attributeNames[i] = attributeNames[i];
         }
-        
+
         this.propertyNames = new String[propertyNames.length];
-        for (int i=0, size=propertyNames.length; i<size; i++) {
+        for ( int i = 0, size = propertyNames.length; i < size; i++ )
+        {
             this.propertyNames[i] = propertyNames[i];
-        } 
+        }
     }
-        
+
     // ----------------------------------------------------- Instance Variables
-    
-    /** 
+
+    /**
      * Attribute names used to override natural attribute->property mapping
      */
-    private String [] attributeNames;
-    /** 
+    private String[] attributeNames;
+
+    /**
      * Property names used to override natural attribute->property mapping
-     */    
-    private String [] propertyNames;
+     */
+    private String[] propertyNames;
 
     /**
-     * Used to determine whether the parsing should fail if an property specified
-     * in the XML is missing from the bean. Default is true for backward compatibility.
+     * Used to determine whether the parsing should fail if an property specified in the XML is missing from the bean.
+     * Default is true for backward compatibility.
      */
     private boolean ignoreMissingProperty = true;
 
-
     // --------------------------------------------------------- Public Methods
 
-
     /**
      * Process the beginning of this element.
-     *
+     * 
      * @param attributes The attribute list of this element
      */
     @Override
-    public void begin(String namespace, String name, Attributes attributes) throws Exception {
-        
+    public void begin( String namespace, String name, Attributes attributes )
+        throws Exception
+    {
+
         // Build a set of attribute names and corresponding values
         HashMap<String, String> values = new HashMap<String, String>();
-        
+
         // set up variables for custom names mappings
         int attNamesLength = 0;
-        if (attributeNames != null) {
+        if ( attributeNames != null )
+        {
             attNamesLength = attributeNames.length;
         }
         int propNamesLength = 0;
-        if (propertyNames != null) {
+        if ( propertyNames != null )
+        {
             propNamesLength = propertyNames.length;
         }
-        
-        
-        for (int i = 0; i < attributes.getLength(); i++) {
-            String attributeName = attributes.getLocalName(i);
-            if ("".equals(attributeName)) {
-                attributeName = attributes.getQName(i);
+
+        for ( int i = 0; i < attributes.getLength(); i++ )
+        {
+            String attributeName = attributes.getLocalName( i );
+            if ( "".equals( attributeName ) )
+            {
+                attributeName = attributes.getQName( i );
             }
-            String value = attributes.getValue(i);
-            
+            String value = attributes.getValue( i );
+
             // we'll now check for custom mappings
-            for (int n = 0; n<attNamesLength; n++) {
-                if (attributeName.equals(attributeNames[n])) {
-                    if (n < propNamesLength) {
+            for ( int n = 0; n < attNamesLength; n++ )
+            {
+                if ( attributeName.equals( attributeNames[n] ) )
+                {
+                    if ( n < propNamesLength )
+                    {
                         // set this to value from list
                         attributeName = propertyNames[n];
-                    
-                    } else {
+
+                    }
+                    else
+                    {
                         // set name to null
                         // we'll check for this later
                         attributeName = null;
                     }
                     break;
                 }
-            } 
-            
-            if (getDigester().getLogger().isDebugEnabled()) {
-                getDigester().getLogger().debug("[SetPropertiesRule]{" + getDigester().getMatch() +
-                        "} Setting property '" + attributeName + "' to '" +
-                        value + "'");
             }
-            
-            if ((!ignoreMissingProperty) && (attributeName != null)) {
+
+            if ( getDigester().getLogger().isDebugEnabled() )
+            {
+                getDigester().getLogger().debug( "[SetPropertiesRule]{" + getDigester().getMatch()
+                                                     + "} Setting property '" + attributeName + "' to '" + value + "'" );
+            }
+
+            if ( ( !ignoreMissingProperty ) && ( attributeName != null ) )
+            {
                 // The BeanUtils.populate method silently ignores items in
                 // the map (ie xml entities) which have no corresponding
                 // setter method, so here we check whether each xml attribute
                 // does have a corresponding property before calling the
                 // BeanUtils.populate method.
                 //
-                // Yes having the test and set as separate steps is ugly and 
-                // inefficient. But BeanUtils.populate doesn't provide the 
-                // functionality we need here, and changing the algorithm which 
-                // determines the appropriate setter method to invoke is 
+                // Yes having the test and set as separate steps is ugly and
+                // inefficient. But BeanUtils.populate doesn't provide the
+                // functionality we need here, and changing the algorithm which
+                // determines the appropriate setter method to invoke is
                 // considered too risky.
                 //
                 // Using two different classes (PropertyUtils vs BeanUtils) to
                 // do the test and the set is also ugly; the codepaths
                 // are different which could potentially lead to trouble.
-                // However the BeanUtils/ProperyUtils code has been carefully 
-                // compared and the PropertyUtils functionality does appear 
+                // However the BeanUtils/ProperyUtils code has been carefully
+                // compared and the PropertyUtils functionality does appear
                 // compatible so we'll accept the risk here.
-                
+
                 Object top = getDigester().peek();
-                boolean test =  PropertyUtils.isWriteable(top, attributeName);
-                if (!test)
-                    throw new NoSuchMethodException("Property " + attributeName + " can't be set");
+                boolean test = PropertyUtils.isWriteable( top, attributeName );
+                if ( !test )
+                    throw new NoSuchMethodException( "Property " + attributeName + " can't be set" );
+            }
+
+            if ( attributeName != null )
+            {
+                values.put( attributeName, value );
             }
-            
-            if (attributeName != null) {
-                values.put(attributeName, value);
-            } 
         }
 
         // Populate the corresponding properties of the top object
         Object top = getDigester().peek();
-        if (getDigester().getLogger().isDebugEnabled()) {
-            if (top != null) {
-                getDigester().getLogger().debug("[SetPropertiesRule]{" + getDigester().getMatch() +
-                                   "} Set " + top.getClass().getName() +
-                                   " properties");
-            } else {
-                getDigester().getLogger().debug("[SetPropertiesRule]{" + getDigester().getMatch() +
-                                   "} Set NULL properties");
+        if ( getDigester().getLogger().isDebugEnabled() )
+        {
+            if ( top != null )
+            {
+                getDigester().getLogger().debug( "[SetPropertiesRule]{" + getDigester().getMatch() + "} Set "
+                                                     + top.getClass().getName() + " properties" );
+            }
+            else
+            {
+                getDigester().getLogger().debug( "[SetPropertiesRule]{" + getDigester().getMatch()
+                                                     + "} Set NULL properties" );
             }
         }
-        BeanUtils.populate(top, values);
-
+        BeanUtils.populate( top, values );
 
     }
 
-
     /**
-     * <p>Add an additional attribute name to property name mapping.
-     * This is intended to be used from the xml rules.
+     * <p>
+     * Add an additional attribute name to property name mapping. This is intended to be used from the xml rules.
      */
-    public void addAlias(String attributeName, String propertyName) {
-        
+    public void addAlias( String attributeName, String propertyName )
+    {
+
         // this is a bit tricky.
         // we'll need to resize the array.
         // probably should be synchronized but digester's not thread safe anyway
-        if (attributeNames == null) {
-            
+        if ( attributeNames == null )
+        {
+
             attributeNames = new String[1];
             attributeNames[0] = attributeName;
             propertyNames = new String[1];
-            propertyNames[0] = propertyName;        
-            
-        } else {
+            propertyNames[0] = propertyName;
+
+        }
+        else
+        {
             int length = attributeNames.length;
-            String [] tempAttributes = new String[length + 1];
-            for (int i=0; i<length; i++) {
+            String[] tempAttributes = new String[length + 1];
+            for ( int i = 0; i < length; i++ )
+            {
                 tempAttributes[i] = attributeNames[i];
             }
             tempAttributes[length] = attributeName;
-            
-            String [] tempProperties = new String[length + 1];
-            for (int i=0; i<length && i< propertyNames.length; i++) {
+
+            String[] tempProperties = new String[length + 1];
+            for ( int i = 0; i < length && i < propertyNames.length; i++ )
+            {
                 tempProperties[i] = propertyNames[i];
             }
             tempProperties[length] = propertyName;
-            
+
             propertyNames = tempProperties;
             attributeNames = tempAttributes;
-        }        
+        }
     }
-  
 
     /**
      * Render a printable version of this Rule.
      */
     @Override
-    public String toString() {
+    public String toString()
+    {
 
-        StringBuilder sb = new StringBuilder("SetPropertiesRule[");
-        sb.append("]");
-        return (sb.toString());
+        StringBuilder sb = new StringBuilder( "SetPropertiesRule[" );
+        sb.append( "]" );
+        return ( sb.toString() );
 
     }
 
     /**
-     * <p>Are attributes found in the xml without matching properties to be ignored?
-     * </p><p>
-     * If false, the parsing will interrupt with an <code>NoSuchMethodException</code>
-     * if a property specified in the XML is not found. The default is true.
+     * <p>
+     * Are attributes found in the xml without matching properties to be ignored?
+     * </p>
+     * <p>
+     * If false, the parsing will interrupt with an <code>NoSuchMethodException</code> if a property specified in the
+     * XML is not found. The default is true.
      * </p>
+     * 
      * @return true if skipping the unmatched attributes.
      */
-    public boolean isIgnoreMissingProperty() {
+    public boolean isIgnoreMissingProperty()
+    {
 
         return this.ignoreMissingProperty;
     }
 
     /**
-     * Sets whether attributes found in the xml without matching properties 
-     * should be ignored.
-     * If set to false, the parsing will throw an <code>NoSuchMethodException</code>
-     * if an unmatched
-     * attribute is found. This allows to trap misspellings in the XML file.
+     * Sets whether attributes found in the xml without matching properties should be ignored. If set to false, the
+     * parsing will throw an <code>NoSuchMethodException</code> if an unmatched attribute is found. This allows to trap
+     * misspellings in the XML file.
+     * 
      * @param ignoreMissingProperty false to stop the parsing on unmatched attributes.
      */
-    public void setIgnoreMissingProperty(boolean ignoreMissingProperty) {
+    public void setIgnoreMissingProperty( boolean ignoreMissingProperty )
+    {
 
         this.ignoreMissingProperty = ignoreMissingProperty;
     }
 
-
 }

Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/SetPropertyRule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/SetPropertyRule.java?rev=1102402&r1=1102401&r2=1102402&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/SetPropertyRule.java (original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/SetPropertyRule.java Thu May 12 18:03:26 2011
@@ -16,10 +16,8 @@
  * limitations under the License.
  */
 
-
 package org.apache.commons.digester3;
 
-
 import java.beans.PropertyDescriptor;
 
 import org.apache.commons.beanutils.BeanUtils;
@@ -28,27 +26,25 @@ import org.apache.commons.beanutils.Dyna
 import org.apache.commons.beanutils.PropertyUtils;
 import org.xml.sax.Attributes;
 
-
 /**
- * Rule implementation that sets an individual property on the object at the
- * top of the stack, based on attributes with specified names.
+ * Rule implementation that sets an individual property on the object at the top of the stack, based on attributes with
+ * specified names.
  */
 
-public class SetPropertyRule extends Rule {
-
+public class SetPropertyRule
+    extends Rule
+{
 
     // ----------------------------------------------------------- Constructors
 
     /**
-     * Construct a "set property" rule with the specified name and value
-     * attributes.
-     *
-     * @param name Name of the attribute that will contain the name of the
-     *  property to be set
-     * @param value Name of the attribute that will contain the value to which
-     *  the property should be set
+     * Construct a "set property" rule with the specified name and value attributes.
+     * 
+     * @param name Name of the attribute that will contain the name of the property to be set
+     * @param value Name of the attribute that will contain the value to which the property should be set
      */
-    public SetPropertyRule(String name, String value) {
+    public SetPropertyRule( String name, String value )
+    {
 
         this.name = name;
         this.value = value;
@@ -57,49 +53,51 @@ public class SetPropertyRule extends Rul
 
     // ----------------------------------------------------- Instance Variables
 
-
     /**
      * The attribute that will contain the property name.
      */
     protected String name = null;
 
-
     /**
      * The attribute that will contain the property value.
      */
     protected String value = null;
 
-
     // --------------------------------------------------------- Public Methods
 
-
     /**
      * Process the beginning of this element.
-     *
+     * 
      * @param attributes The attribute list of this element
-     *
-     * @exception NoSuchMethodException if the bean does not
-     *  have a writeable property of the specified name
+     * @exception NoSuchMethodException if the bean does not have a writeable property of the specified name
      */
     @Override
-    public void begin(String namespace, String name, Attributes attributes) throws Exception {
+    public void begin( String namespace, String name, Attributes attributes )
+        throws Exception
+    {
 
-        if (attributes.getLength() == 0 ) {
+        if ( attributes.getLength() == 0 )
+        {
             return;
         }
 
         // Identify the actual property name and value to be used
         String actualName = null;
         String actualValue = null;
-        for (int i = 0; i < attributes.getLength(); i++) {
-            String attributeName = attributes.getLocalName(i);
-            if ("".equals(attributeName)) {
-                attributeName = attributes.getQName(i);
+        for ( int i = 0; i < attributes.getLength(); i++ )
+        {
+            String attributeName = attributes.getLocalName( i );
+            if ( "".equals( attributeName ) )
+            {
+                attributeName = attributes.getQName( i );
             }
-            String value = attributes.getValue(i);
-            if (attributeName.equals(this.name)) {
+            String value = attributes.getValue( i );
+            if ( attributeName.equals( this.name ) )
+            {
                 actualName = value;
-            } else if (attributeName.equals(this.value)) {
+            }
+            else if ( attributeName.equals( this.value ) )
+            {
                 actualValue = value;
             }
         }
@@ -108,54 +106,55 @@ public class SetPropertyRule extends Rul
         Object top = getDigester().peek();
 
         // Log some debugging information
-        if (getDigester().getLogger().isDebugEnabled()) {
-            getDigester().getLogger().debug("[SetPropertyRule]{" + getDigester().getMatch() +
-                    "} Set " + top.getClass().getName() + " property " +
-                    actualName + " to " + actualValue);
+        if ( getDigester().getLogger().isDebugEnabled() )
+        {
+            getDigester().getLogger().debug( "[SetPropertyRule]{" + getDigester().getMatch() + "} Set "
+                                                 + top.getClass().getName() + " property " + actualName + " to "
+                                                 + actualValue );
         }
 
         // Force an exception if the property does not exist
         // (BeanUtils.setProperty() silently returns in this case)
         //
-        // This code should probably use PropertyUtils.isWriteable(), 
+        // This code should probably use PropertyUtils.isWriteable(),
         // like SetPropertiesRule does.
-        if (top instanceof DynaBean) {
-            DynaProperty desc =
-                ((DynaBean) top).getDynaClass().getDynaProperty(actualName);
-            if (desc == null) {
-                throw new NoSuchMethodException
-                    ("Bean has no property named " + actualName);
+        if ( top instanceof DynaBean )
+        {
+            DynaProperty desc = ( (DynaBean) top ).getDynaClass().getDynaProperty( actualName );
+            if ( desc == null )
+            {
+                throw new NoSuchMethodException( "Bean has no property named " + actualName );
             }
-        } else /* this is a standard JavaBean */ {
-            PropertyDescriptor desc =
-                PropertyUtils.getPropertyDescriptor(top, actualName);
-            if (desc == null) {
-                throw new NoSuchMethodException
-                    ("Bean has no property named " + actualName);
+        }
+        else
+        /* this is a standard JavaBean */{
+            PropertyDescriptor desc = PropertyUtils.getPropertyDescriptor( top, actualName );
+            if ( desc == null )
+            {
+                throw new NoSuchMethodException( "Bean has no property named " + actualName );
             }
         }
 
         // Set the property (with conversion as necessary)
-        BeanUtils.setProperty(top, actualName, actualValue);
+        BeanUtils.setProperty( top, actualName, actualValue );
 
     }
 
-
     /**
      * Render a printable version of this Rule.
      */
     @Override
-    public String toString() {
+    public String toString()
+    {
 
-        StringBuilder sb = new StringBuilder("SetPropertyRule[");
-        sb.append("name=");
-        sb.append(name);
-        sb.append(", value=");
-        sb.append(value);
-        sb.append("]");
-        return (sb.toString());
+        StringBuilder sb = new StringBuilder( "SetPropertyRule[" );
+        sb.append( "name=" );
+        sb.append( name );
+        sb.append( ", value=" );
+        sb.append( value );
+        sb.append( "]" );
+        return ( sb.toString() );
 
     }
 
-
 }

Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/SetRootRule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/SetRootRule.java?rev=1102402&r1=1102401&r2=1102402&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/SetRootRule.java (original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/SetRootRule.java Thu May 12 18:03:26 2011
@@ -16,54 +16,50 @@
  * limitations under the License.
  */
 
-
 package org.apache.commons.digester3;
 
-
 import org.apache.commons.beanutils.MethodUtils;
 
-
 /**
- * <p>Rule implementation that calls a method on the root object on the stack,
- * passing the top object (child) as an argument.
- * It is important to remember that this rule acts on <code>end</code>.</p>
- *
- * <p>This rule now supports more flexible method matching by default.
- * It is possible that this may break (some) code 
- * written against release 1.1.1 or earlier.
- * See {@link #isExactMatch()} for more details.</p>
+ * <p>
+ * Rule implementation that calls a method on the root object on the stack, passing the top object (child) as an
+ * argument. It is important to remember that this rule acts on <code>end</code>.
+ * </p>
+ * <p>
+ * This rule now supports more flexible method matching by default. It is possible that this may break (some) code
+ * written against release 1.1.1 or earlier. See {@link #isExactMatch()} for more details.
+ * </p>
  */
 
-public class SetRootRule extends Rule {
-
+public class SetRootRule
+    extends Rule
+{
 
     // ----------------------------------------------------------- Constructors
 
     /**
-     * Construct a "set root" rule with the specified method name.  The
-     * method's argument type is assumed to be the class of the
-     * child object.
-     *
+     * Construct a "set root" rule with the specified method name. The method's argument type is assumed to be the class
+     * of the child object.
+     * 
      * @param methodName Method name of the parent method to call
      */
-    public SetRootRule(String methodName) {
+    public SetRootRule( String methodName )
+    {
 
-        this(methodName, null);
+        this( methodName, null );
 
     }
 
-
     /**
      * Construct a "set root" rule with the specified method name.
-     *
+     * 
      * @param methodName Method name of the parent method to call
-     * @param paramType Java class of the 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)
+     * @param paramType Java class of the 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)
      */
-    public SetRootRule(String methodName,
-                       String paramType) {
+    public SetRootRule( String methodName, String paramType )
+    {
 
         this.methodName = methodName;
         this.paramType = paramType;
@@ -72,62 +68,64 @@ public class SetRootRule extends Rule {
 
     // ----------------------------------------------------- Instance Variables
 
-
     /**
      * The method name to call on the parent object.
      */
     protected String methodName = null;
 
-
     /**
      * The Java class name of the parameter type expected by the method.
      */
     protected String paramType = null;
-    
+
     /**
      * Should we use exact matching. Default is no.
      */
     protected boolean useExactMatch = false;
 
-
     // --------------------------------------------------------- Public Methods
 
-
     /**
-     * <p>Is exact matching being used.</p>
-     *
-     * <p>This rule uses <code>org.apache.commons.beanutils.MethodUtils</code> 
-     * to introspect the relevent objects so that the right method can be called.
-     * Originally, <code>MethodUtils.invokeExactMethod</code> was used.
-     * This matches methods very strictly 
-     * and so may not find a matching method when one exists.
-     * This is still the behaviour when exact matching is enabled.</p>
-     *
-     * <p>When exact matching is disabled, <code>MethodUtils.invokeMethod</code> is used.
-     * This method finds more methods but is less precise when there are several methods 
-     * with correct signatures.
-     * So, if you want to choose an exact signature you might need to enable this property.</p>
-     *
-     * <p>The default setting is to disable exact matches.</p>
-     *
+     * <p>
+     * Is exact matching being used.
+     * </p>
+     * <p>
+     * This rule uses <code>org.apache.commons.beanutils.MethodUtils</code> to introspect the relevent objects so that
+     * the right method can be called. Originally, <code>MethodUtils.invokeExactMethod</code> was used. This matches
+     * methods very strictly and so may not find a matching method when one exists. This is still the behaviour when
+     * exact matching is enabled.
+     * </p>
+     * <p>
+     * When exact matching is disabled, <code>MethodUtils.invokeMethod</code> is used. This method finds more methods
+     * but is less precise when there are several methods with correct signatures. So, if you want to choose an exact
+     * signature you might need to enable this property.
+     * </p>
+     * <p>
+     * The default setting is to disable exact matches.
+     * </p>
+     * 
      * @return true iff exact matching is enabled
      * @since Digester Release 1.1.1
      */
-    public boolean isExactMatch() {
-    
+    public boolean isExactMatch()
+    {
+
         return useExactMatch;
     }
-    
-    
+
     /**
-     * <p>Set whether exact matching is enabled.</p>
-     *
-     * <p>See {@link #isExactMatch()}.</p>
-     *
+     * <p>
+     * Set whether exact matching is enabled.
+     * </p>
+     * <p>
+     * See {@link #isExactMatch()}.
+     * </p>
+     * 
      * @param useExactMatch should this rule use exact method matching
      * @since Digester Release 1.1.1
      */
-    public void setExactMatch(boolean useExactMatch) {
+    public void setExactMatch( boolean useExactMatch )
+    {
 
         this.useExactMatch = useExactMatch;
     }
@@ -136,61 +134,68 @@ public class SetRootRule extends Rule {
      * Process the end of this element.
      */
     @Override
-    public void end(String namespace, String name) throws Exception {
+    public void end( String namespace, String name )
+        throws Exception
+    {
 
         // Identify the objects to be used
-        Object child = getDigester().peek(0);
+        Object child = getDigester().peek( 0 );
         Object parent = getDigester().getRoot();
-        if (getDigester().getLogger().isDebugEnabled()) {
-            if (parent == null) {
-                getDigester().getLogger().debug("[SetRootRule]{" + getDigester().getMatch() +
-                        "} Call [NULL ROOT]." +
-                        methodName + "(" + child + ")");
-            } else {
-                getDigester().getLogger().debug("[SetRootRule]{" + getDigester().getMatch() +
-                        "} Call " + parent.getClass().getName() + "." +
-                        methodName + "(" + child + ")");
+        if ( getDigester().getLogger().isDebugEnabled() )
+        {
+            if ( parent == null )
+            {
+                getDigester().getLogger().debug( "[SetRootRule]{" + getDigester().getMatch() + "} Call [NULL ROOT]."
+                                                     + methodName + "(" + child + ")" );
+            }
+            else
+            {
+                getDigester().getLogger().debug( "[SetRootRule]{" + getDigester().getMatch() + "} Call "
+                                                     + parent.getClass().getName() + "." + methodName + "(" + child
+                                                     + ")" );
             }
         }
 
         // Call the specified method
         Class<?> paramTypes[] = new Class<?>[1];
-        if (paramType != null) {
-            paramTypes[0] =
-                    getDigester().getClassLoader().loadClass(paramType);
-        } else {
+        if ( paramType != null )
+        {
+            paramTypes[0] = getDigester().getClassLoader().loadClass( paramType );
+        }
+        else
+        {
             paramTypes[0] = child.getClass();
         }
-        
-        if (useExactMatch) {
-        
-            MethodUtils.invokeExactMethod(parent, methodName,
-                new Object[]{ child }, paramTypes);
-                
-        } else {
-        
-            MethodUtils.invokeMethod(parent, methodName,
-                new Object[]{ child }, paramTypes);
-        
+
+        if ( useExactMatch )
+        {
+
+            MethodUtils.invokeExactMethod( parent, methodName, new Object[] { child }, paramTypes );
+
         }
-    }
+        else
+        {
 
+            MethodUtils.invokeMethod( parent, methodName, new Object[] { child }, paramTypes );
+
+        }
+    }
 
     /**
      * Render a printable version of this Rule.
      */
     @Override
-    public String toString() {
+    public String toString()
+    {
 
-        StringBuilder sb = new StringBuilder("SetRootRule[");
-        sb.append("methodName=");
-        sb.append(methodName);
-        sb.append(", paramType=");
-        sb.append(paramType);
-        sb.append("]");
-        return (sb.toString());
+        StringBuilder sb = new StringBuilder( "SetRootRule[" );
+        sb.append( "methodName=" );
+        sb.append( methodName );
+        sb.append( ", paramType=" );
+        sb.append( paramType );
+        sb.append( "]" );
+        return ( sb.toString() );
 
     }
 
-
 }

Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/SetTopRule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/SetTopRule.java?rev=1102402&r1=1102401&r2=1102402&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/SetTopRule.java (original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/SetTopRule.java Thu May 12 18:03:26 2011
@@ -16,180 +16,187 @@
  * limitations under the License.
  */
 
-
 package org.apache.commons.digester3;
 
-
 import org.apache.commons.beanutils.MethodUtils;
 
-
 /**
- * <p>Rule implementation that calls a "set parent" method on the top (child)
- * object, passing the (top-1) (parent) object as an argument.</p>
- *
- * <p>This rule now supports more flexible method matching by default.
- * It is possible that this may break (some) code 
- * written against release 1.1.1 or earlier.
- * See {@link #isExactMatch()} for more details.</p>
+ * <p>
+ * Rule implementation that calls a "set parent" method on the top (child) object, passing the (top-1) (parent) object
+ * as an argument.
+ * </p>
+ * <p>
+ * This rule now supports more flexible method matching by default. It is possible that this may break (some) code
+ * written against release 1.1.1 or earlier. See {@link #isExactMatch()} for more details.
+ * </p>
  */
 
-public class SetTopRule extends Rule {
-
+public class SetTopRule
+    extends Rule
+{
 
     // ----------------------------------------------------------- Constructors
 
     /**
-     * Construct a "set parent" rule with the specified method name.  The
-     * "set parent" method's argument type is assumed to be the class of the
-     * parent object.
-     *
+     * Construct a "set parent" rule with the specified method name. The "set parent" method's argument type is assumed
+     * to be the class of the parent object.
+     * 
      * @param methodName Method name of the "set parent" method to call
      */
-    public SetTopRule(String methodName) {
+    public SetTopRule( String methodName )
+    {
 
-        this(methodName, null);
+        this( methodName, null );
 
     }
 
-
     /**
      * Construct a "set parent" rule with the specified method name.
-     *
+     * 
      * @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)
+     * @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)
      */
-    public SetTopRule(String methodName,
-                      String paramType) {
+    public SetTopRule( String methodName, String paramType )
+    {
 
         this.methodName = methodName;
         this.paramType = paramType;
 
     }
 
-
     // ----------------------------------------------------- Instance Variables
 
-
     /**
      * The method name to call on the child object.
      */
     protected String methodName = null;
 
-
     /**
      * The Java class name of the parameter type expected by the method.
      */
     protected String paramType = null;
-    
+
     /**
      * Should we use exact matching. Default is no.
      */
     protected boolean useExactMatch = false;
 
-
     // --------------------------------------------------------- Public Methods
 
     /**
-     * <p>Is exact matching being used.</p>
-     *
-     * <p>This rule uses <code>org.apache.commons.beanutils.MethodUtils</code> 
-     * to introspect the relevent objects so that the right method can be called.
-     * Originally, <code>MethodUtils.invokeExactMethod</code> was used.
-     * This matches methods very strictly 
-     * and so may not find a matching method when one exists.
-     * This is still the behaviour when exact matching is enabled.</p>
-     *
-     * <p>When exact matching is disabled, <code>MethodUtils.invokeMethod</code> is used.
-     * This method finds more methods but is less precise when there are several methods 
-     * with correct signatures.
-     * So, if you want to choose an exact signature you might need to enable this property.</p>
-     *
-     * <p>The default setting is to disable exact matches.</p>
-     *
+     * <p>
+     * Is exact matching being used.
+     * </p>
+     * <p>
+     * This rule uses <code>org.apache.commons.beanutils.MethodUtils</code> to introspect the relevent objects so that
+     * the right method can be called. Originally, <code>MethodUtils.invokeExactMethod</code> was used. This matches
+     * methods very strictly and so may not find a matching method when one exists. This is still the behaviour when
+     * exact matching is enabled.
+     * </p>
+     * <p>
+     * When exact matching is disabled, <code>MethodUtils.invokeMethod</code> is used. This method finds more methods
+     * but is less precise when there are several methods with correct signatures. So, if you want to choose an exact
+     * signature you might need to enable this property.
+     * </p>
+     * <p>
+     * The default setting is to disable exact matches.
+     * </p>
+     * 
      * @return true iff exact matching is enabled
      * @since Digester Release 1.1.1
      */
-    public boolean isExactMatch() {
-    
+    public boolean isExactMatch()
+    {
+
         return useExactMatch;
     }
-    
+
     /**
-     * <p>Set whether exact matching is enabled.</p>
-     *
-     * <p>See {@link #isExactMatch()}.</p>
-     *
+     * <p>
+     * Set whether exact matching is enabled.
+     * </p>
+     * <p>
+     * See {@link #isExactMatch()}.
+     * </p>
+     * 
      * @param useExactMatch should this rule use exact method matching
      * @since Digester Release 1.1.1
      */
-    public void setExactMatch(boolean useExactMatch) {
+    public void setExactMatch( boolean useExactMatch )
+    {
 
         this.useExactMatch = useExactMatch;
     }
-    
+
     /**
      * Process the end of this element.
      */
     @Override
-    public void end(String namespace, String name) throws Exception {
+    public void end( String namespace, String name )
+        throws Exception
+    {
 
         // Identify the objects to be used
-        Object child = getDigester().peek(0);
-        Object parent = getDigester().peek(1);
-        
-        if (getDigester().getLogger().isDebugEnabled()) {
-            if (child == null) {
-                getDigester().getLogger().debug("[SetTopRule]{" + getDigester().getMatch() +
-                        "} Call [NULL CHILD]." +
-                        methodName + "(" + parent + ")");
-            } else {
-                getDigester().getLogger().debug("[SetTopRule]{" + getDigester().getMatch() +
-                        "} Call " + child.getClass().getName() + "." +
-                        methodName + "(" + parent + ")");
+        Object child = getDigester().peek( 0 );
+        Object parent = getDigester().peek( 1 );
+
+        if ( getDigester().getLogger().isDebugEnabled() )
+        {
+            if ( child == null )
+            {
+                getDigester().getLogger().debug( "[SetTopRule]{" + getDigester().getMatch() + "} Call [NULL CHILD]."
+                                                     + methodName + "(" + parent + ")" );
+            }
+            else
+            {
+                getDigester().getLogger().debug( "[SetTopRule]{" + getDigester().getMatch() + "} Call "
+                                                     + child.getClass().getName() + "." + methodName + "(" + parent
+                                                     + ")" );
             }
         }
 
         // Call the specified method
         Class<?> paramTypes[] = new Class<?>[1];
-        if (paramType != null) {
-            paramTypes[0] =
-                    getDigester().getClassLoader().loadClass(paramType);
-        } else {
+        if ( paramType != null )
+        {
+            paramTypes[0] = getDigester().getClassLoader().loadClass( paramType );
+        }
+        else
+        {
             paramTypes[0] = parent.getClass();
         }
 
-        if (useExactMatch) {
-        
-            MethodUtils.invokeExactMethod(child, methodName,
-                new Object[]{ parent }, paramTypes);
-                
-        } else {
-        
-            MethodUtils.invokeMethod(child, methodName,
-                new Object[]{ parent }, paramTypes);
-        
+        if ( useExactMatch )
+        {
+
+            MethodUtils.invokeExactMethod( child, methodName, new Object[] { parent }, paramTypes );
+
         }
-    }
+        else
+        {
 
+            MethodUtils.invokeMethod( child, methodName, new Object[] { parent }, paramTypes );
+
+        }
+    }
 
     /**
      * Render a printable version of this Rule.
      */
     @Override
-    public String toString() {
+    public String toString()
+    {
 
-        StringBuilder sb = new StringBuilder("SetTopRule[");
-        sb.append("methodName=");
-        sb.append(methodName);
-        sb.append(", paramType=");
-        sb.append(paramType);
-        sb.append("]");
-        return (sb.toString());
+        StringBuilder sb = new StringBuilder( "SetTopRule[" );
+        sb.append( "methodName=" );
+        sb.append( methodName );
+        sb.append( ", paramType=" );
+        sb.append( paramType );
+        sb.append( "]" );
+        return ( sb.toString() );
 
     }
 
-
 }



Mime
View raw message