You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by si...@apache.org on 2011/05/12 20:03:33 UTC

svn commit: r1102402 [5/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...

Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/ObjectCreateRule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/ObjectCreateRule.java?rev=1102402&r1=1102401&r2=1102402&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/ObjectCreateRule.java (original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/ObjectCreateRule.java Thu May 12 18:03:26 2011
@@ -16,157 +16,151 @@
  * limitations under the License.
  */
 
-
 package org.apache.commons.digester3;
 
-
 import org.xml.sax.Attributes;
 
-
 /**
- * Rule implementation that creates a new object and pushes it
- * onto the object stack.  When the element is complete, the
+ * Rule implementation that creates a new object and pushes it onto the object stack. When the element is complete, the
  * object will be popped
  */
 
-public class ObjectCreateRule extends Rule {
-
+public class ObjectCreateRule
+    extends Rule
+{
 
     // ----------------------------------------------------------- Constructors
 
     /**
      * Construct an object create rule with the specified class name.
-     *
+     * 
      * @param className Java class name of the object to be created
      */
-    public ObjectCreateRule(String className) {
+    public ObjectCreateRule( String className )
+    {
 
-        this(className, (String) null);
+        this( className, (String) null );
 
     }
 
-
     /**
      * Construct an object create rule with the specified class.
-     *
+     * 
      * @param clazz Java class name of the object to be created
      */
-    public ObjectCreateRule(Class<?> clazz) {
+    public ObjectCreateRule( Class<?> clazz )
+    {
 
-        this(clazz.getName(), (String) null);
+        this( clazz.getName(), (String) null );
 
     }
 
-
     /**
-     * Construct an object create rule with the specified class name and an
-     * optional attribute name containing an override.
-     *
+     * Construct an object create rule with the specified class name and an optional attribute name containing an
+     * override.
+     * 
      * @param className Java class name of the object to be created
-     * @param attributeName Attribute name which, if present, contains an
-     *  override of the class name to create
+     * @param attributeName Attribute name which, if present, contains an override of the class name to create
      */
-    public ObjectCreateRule(String className,
-                            String attributeName) {
+    public ObjectCreateRule( String className, String attributeName )
+    {
 
         this.className = className;
         this.attributeName = attributeName;
 
     }
 
-
     /**
-     * Construct an object create rule with the specified class and an
-     * optional attribute name containing an override.
-     *
+     * Construct an object create rule with the specified class and an optional attribute name containing an override.
+     * 
      * @param attributeName Attribute name which, if present, contains an
-     * @param clazz Java class name of the object to be created
-     *  override of the class name to create
+     * @param clazz Java class name of the object to be created override of the class name to create
      */
-    public ObjectCreateRule(String attributeName,
-                            Class<?> clazz) {
+    public ObjectCreateRule( String attributeName, Class<?> clazz )
+    {
 
-        this(clazz.getName(), attributeName);
+        this( clazz.getName(), attributeName );
 
     }
 
     // ----------------------------------------------------- Instance Variables
 
-
     /**
      * The attribute containing an override class name if it is present.
      */
     protected String attributeName = null;
 
-
     /**
      * The Java class name of the object to be created.
      */
     protected String className = null;
 
-
     // --------------------------------------------------------- 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
+    {
 
         // Identify the name of the class to instantiate
         String realClassName = className;
-        if (attributeName != null) {
-            String value = attributes.getValue(attributeName);
-            if (value != null) {
+        if ( attributeName != null )
+        {
+            String value = attributes.getValue( attributeName );
+            if ( value != null )
+            {
                 realClassName = value;
             }
         }
-        if (getDigester().getLogger().isDebugEnabled()) {
-            getDigester().getLogger().debug("[ObjectCreateRule]{" + getDigester().getMatch() +
-                    "}New " + realClassName);
+        if ( getDigester().getLogger().isDebugEnabled() )
+        {
+            getDigester().getLogger().debug( "[ObjectCreateRule]{" + getDigester().getMatch() + "}New " + realClassName );
         }
 
         // Instantiate the new object and push it on the context stack
-        Class<?> clazz = getDigester().getClassLoader().loadClass(realClassName);
+        Class<?> clazz = getDigester().getClassLoader().loadClass( realClassName );
         Object instance = clazz.newInstance();
-        getDigester().push(instance);
+        getDigester().push( instance );
 
     }
 
-
     /**
      * 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
+    {
 
         Object top = getDigester().pop();
-        if (getDigester().getLogger().isDebugEnabled()) {
-            getDigester().getLogger().debug("[ObjectCreateRule]{" + getDigester().getMatch() +
-                    "} Pop " + top.getClass().getName());
+        if ( getDigester().getLogger().isDebugEnabled() )
+        {
+            getDigester().getLogger().debug( "[ObjectCreateRule]{" + getDigester().getMatch() + "} Pop "
+                                                 + top.getClass().getName() );
         }
 
     }
 
-
     /**
      * Render a printable version of this Rule.
      */
     @Override
-    public String toString() {
+    public String toString()
+    {
 
-        StringBuilder sb = new StringBuilder("ObjectCreateRule[");
-        sb.append("className=");
-        sb.append(className);
-        sb.append(", attributeName=");
-        sb.append(attributeName);
-        sb.append("]");
-        return (sb.toString());
+        StringBuilder sb = new StringBuilder( "ObjectCreateRule[" );
+        sb.append( "className=" );
+        sb.append( className );
+        sb.append( ", attributeName=" );
+        sb.append( attributeName );
+        sb.append( "]" );
+        return ( sb.toString() );
 
     }
 
-
 }

Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/ObjectCreationFactory.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/ObjectCreationFactory.java?rev=1102402&r1=1102401&r2=1102402&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/ObjectCreationFactory.java (original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/ObjectCreationFactory.java Thu May 12 18:03:26 2011
@@ -18,43 +18,43 @@
 
 package org.apache.commons.digester3;
 
-
 import org.xml.sax.Attributes;
 
 /**
- * <p> Interface for use with {@link FactoryCreateRule}.
- * The rule calls {@link #createObject} to create an object
- * to be pushed onto the <code>Digester</code> stack
- * whenever it is matched.</p>
- *
- * <p> {@link AbstractObjectCreationFactory} is an abstract
- * implementation suitable for creating anonymous
+ * <p>
+ * Interface for use with {@link FactoryCreateRule}. The rule calls {@link #createObject} to create an object to be
+ * pushed onto the <code>Digester</code> stack whenever it is matched.
+ * </p>
+ * <p>
+ * {@link AbstractObjectCreationFactory} is an abstract implementation suitable for creating anonymous
  * <code>ObjectCreationFactory</code> implementations.
  */
-public interface ObjectCreationFactory {
+public interface ObjectCreationFactory
+{
 
     /**
-     * <p>Factory method called by {@link FactoryCreateRule} to supply an
-     * object based on the element's attributes.
-     *
+     * <p>
+     * Factory method called by {@link FactoryCreateRule} to supply an object based on the element's attributes.
+     * 
      * @param attributes the element's attributes
-     *
      * @throws Exception any exception thrown will be propagated upwards
      */
-    public Object createObject(Attributes attributes) throws Exception;
+    public Object createObject( Attributes attributes )
+        throws Exception;
 
     /**
-     * <p>Returns the {@link Digester} that was set by the
-     * {@link FactoryCreateRule} upon initialization.
+     * <p>
+     * Returns the {@link Digester} that was set by the {@link FactoryCreateRule} upon initialization.
      */
     public Digester getDigester();
 
     /**
-     * <p>Set the {@link Digester} to allow the implementation to do logging,
-     * classloading based on the digester's classloader, etc.
-     *
+     * <p>
+     * Set the {@link Digester} to allow the implementation to do logging, classloading based on the digester's
+     * classloader, etc.
+     * 
      * @param digester parent Digester object
      */
-    public void setDigester(Digester digester);
+    public void setDigester( Digester digester );
 
 }

Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/ObjectParamRule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/ObjectParamRule.java?rev=1102402&r1=1102401&r2=1102402&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/ObjectParamRule.java (original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/ObjectParamRule.java Thu May 12 18:03:26 2011
@@ -16,58 +16,57 @@
  * limitations under the License.
  */
 
-
 package org.apache.commons.digester3;
 
 import org.xml.sax.Attributes;
 
 /**
- * <p>Rule implementation that saves a parameter for use by a surrounding
- * <code>CallMethodRule<code>.</p>
- *
- * <p>This parameter may be:
+ * <p>
+ * Rule implementation that saves a parameter for use by a surrounding <code>CallMethodRule<code>.
+ * </p>
+ * <p>
+ * This parameter may be:
  * <ul>
- * <li>an arbitrary Object defined programatically, assigned when the element 
- *  pattern associated with the Rule is matched. See 
- * {@link #ObjectParamRule(int paramIndex, Object param)}.
- * <li>an arbitrary Object defined programatically, assigned if the element 
- * pattern AND specified attribute name are matched. See 
- * {@link #ObjectParamRule(int paramIndex, String attributeName, Object param)}.
+ * <li>an arbitrary Object defined programatically, assigned when the element pattern associated with the Rule is
+ * matched. See {@link #ObjectParamRule(int paramIndex, Object param)}.
+ * <li>an arbitrary Object defined programatically, assigned if the element pattern AND specified attribute name are
+ * matched. See {@link #ObjectParamRule(int paramIndex, String attributeName, Object param)}.
  * </ul>
  * </p>
- *
+ * 
  * @since 1.4
  */
 
-public class ObjectParamRule extends Rule {
+public class ObjectParamRule
+    extends Rule
+{
     // ----------------------------------------------------------- Constructors
     /**
-     * Construct a "call parameter" rule that will save the given Object as
-     * the parameter value.
-     *
+     * Construct a "call parameter" rule that will save the given Object as the parameter value.
+     * 
      * @param paramIndex The zero-relative parameter number
      * @param param the parameter to pass along
      */
-    public ObjectParamRule(int paramIndex, Object param) {
-        this(paramIndex, null, param);
+    public ObjectParamRule( int paramIndex, Object param )
+    {
+        this( paramIndex, null, param );
     }
 
-
     /**
-     * Construct a "call parameter" rule that will save the given Object as
-     * the parameter value, provided that the specified attribute exists.
-     *
+     * Construct a "call parameter" rule that will save the given Object as the parameter value, provided that the
+     * specified attribute exists.
+     * 
      * @param paramIndex The zero-relative parameter number
      * @param attributeName The name of the attribute to match
      * @param param the parameter to pass along
      */
-    public ObjectParamRule(int paramIndex, String attributeName, Object param) {
+    public ObjectParamRule( int paramIndex, String attributeName, Object param )
+    {
         this.paramIndex = paramIndex;
         this.attributeName = attributeName;
         this.param = param;
     }
 
-
     // ----------------------------------------------------- Instance Variables
 
     /**
@@ -85,28 +84,32 @@ public class ObjectParamRule extends Rul
      */
     protected Object param = null;
 
-
     // --------------------------------------------------------- Public Methods
 
     /**
      * Process the start of this element.
-     *
+     * 
      * @param attributes The attribute list for 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
+    {
         Object anAttribute = null;
         Object parameters[] = getDigester().peekParams();
 
-        if (attributeName != null) {
-            anAttribute = attributes.getValue(attributeName);
-            if(anAttribute != null) {
+        if ( attributeName != null )
+        {
+            anAttribute = attributes.getValue( attributeName );
+            if ( anAttribute != null )
+            {
                 parameters[paramIndex] = param;
             }
             // note -- if attributeName != null and anAttribute == null, this rule
             // will pass null as its parameter!
-        }else{
+        }
+        else
+        {
             parameters[paramIndex] = param;
         }
     }
@@ -115,15 +118,16 @@ public class ObjectParamRule extends Rul
      * Render a printable version of this Rule.
      */
     @Override
-    public String toString() {
-        StringBuilder sb = new StringBuilder("ObjectParamRule[");
-        sb.append("paramIndex=");
-        sb.append(paramIndex);
-        sb.append(", attributeName=");
-        sb.append(attributeName);
-        sb.append(", param=");
-        sb.append(param);
-        sb.append("]");
-        return (sb.toString());
+    public String toString()
+    {
+        StringBuilder sb = new StringBuilder( "ObjectParamRule[" );
+        sb.append( "paramIndex=" );
+        sb.append( paramIndex );
+        sb.append( ", attributeName=" );
+        sb.append( attributeName );
+        sb.append( ", param=" );
+        sb.append( param );
+        sb.append( "]" );
+        return ( sb.toString() );
     }
 }

Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/PathCallParamRule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/PathCallParamRule.java?rev=1102402&r1=1102401&r2=1102402&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/PathCallParamRule.java (original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/PathCallParamRule.java Thu May 12 18:03:26 2011
@@ -16,37 +16,38 @@
  * limitations under the License.
  */
 
-
 package org.apache.commons.digester3;
 
-
 import org.xml.sax.Attributes;
 
 /**
- * <p>Rule implementation that saves a parameter containing the 
- * <code>Digester</code> matching path for use by a surrounding 
- * <code>CallMethodRule</code>. This Rule is most useful when making 
- * extensive use of wildcards in rule patterns.</p>
- *
+ * <p>
+ * Rule implementation that saves a parameter containing the <code>Digester</code> matching path for use by a
+ * surrounding <code>CallMethodRule</code>. This Rule is most useful when making extensive use of wildcards in rule
+ * patterns.
+ * </p>
+ * 
  * @since 1.6
  */
 
-public class PathCallParamRule extends Rule {
+public class PathCallParamRule
+    extends Rule
+{
 
     // ----------------------------------------------------------- Constructors
 
     /**
-     * Construct a "call parameter" rule that will save the body text of this
-     * element as the parameter value.
-     *
+     * Construct a "call parameter" rule that will save the body text of this element as the parameter value.
+     * 
      * @param paramIndex The zero-relative parameter number
      */
-    public PathCallParamRule(int paramIndex) {
+    public PathCallParamRule( int paramIndex )
+    {
 
         this.paramIndex = paramIndex;
 
     }
- 
+
     // ----------------------------------------------------- Instance Variables
 
     /**
@@ -56,41 +57,41 @@ public class PathCallParamRule extends R
 
     // --------------------------------------------------------- Public Methods
 
-
     /**
      * Process the start of this element.
-     *
-     * @param namespace the namespace URI of the matching element, or an 
-     *   empty string if the parser is not namespace aware or the element has
-     *   no namespace
-     * @param name the local name if the parser is namespace aware, or just 
-     *   the element name otherwise
+     * 
+     * @param namespace the namespace URI of the matching element, or an empty string if the parser is not namespace
+     *            aware or the element has no namespace
+     * @param name the local name if the parser is namespace aware, or just the element name otherwise
      * @param attributes The attribute list for 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
+    {
 
         String param = getDigester().getMatch();
-        
-        if(param != null) {
+
+        if ( param != null )
+        {
             Object parameters[] = getDigester().peekParams();
             parameters[paramIndex] = param;
         }
-        
+
     }
 
     /**
      * Render a printable version of this Rule.
      */
     @Override
-    public String toString() {
+    public String toString()
+    {
 
-        StringBuilder sb = new StringBuilder("PathCallParamRule[");
-        sb.append("paramIndex=");
-        sb.append(paramIndex);
-        sb.append("]");
-        return (sb.toString());
+        StringBuilder sb = new StringBuilder( "PathCallParamRule[" );
+        sb.append( "paramIndex=" );
+        sb.append( paramIndex );
+        sb.append( "]" );
+        return ( sb.toString() );
 
     }
 }

Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/RegexMatcher.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/RegexMatcher.java?rev=1102402&r1=1102401&r2=1102402&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/RegexMatcher.java (original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/RegexMatcher.java Thu May 12 18:03:26 2011
@@ -18,23 +18,23 @@
 
 package org.apache.commons.digester3;
 
-
 /**
  * Regular expression matching strategy for RegexRules.
- *
+ * 
  * @since 1.5
  */
 
-abstract public class RegexMatcher {
-    
-    /** 
-     * Returns true if the given pattern matches the given path 
-     * according to the regex algorithm that this strategy applies.
-     *
+abstract public class RegexMatcher
+{
+
+    /**
+     * Returns true if the given pattern matches the given path according to the regex algorithm that this strategy
+     * applies.
+     * 
      * @param pathPattern the standard digester path representing the element
      * @param rulePattern the regex pattern the path will be tested against
      * @return true if the given pattern matches the given path
      */
-    abstract public boolean match(String pathPattern, String rulePattern);
-    
+    abstract public boolean match( String pathPattern, String rulePattern );
+
 }

Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/RegexRules.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/RegexRules.java?rev=1102402&r1=1102401&r2=1102402&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/RegexRules.java (original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/RegexRules.java Thu May 12 18:03:26 2011
@@ -22,22 +22,27 @@ import java.util.ArrayList;
 import java.util.List;
 
 /**
- * <p>Rules implementation that uses regular expression matching for paths.</p>
- *
- * <p>The regex implementation is pluggable, allowing different strategies to be used.
- * The basic way that this class work does not vary.
- * All patterns are tested to see if they match the path using the regex matcher.
- * All those that do are return in the order which the rules were added.</p>
- *
+ * <p>
+ * Rules implementation that uses regular expression matching for paths.
+ * </p>
+ * <p>
+ * The regex implementation is pluggable, allowing different strategies to be used. The basic way that this class work
+ * does not vary. All patterns are tested to see if they match the path using the regex matcher. All those that do are
+ * return in the order which the rules were added.
+ * </p>
+ * 
  * @since 1.5
  */
 
-public class RegexRules extends AbstractRulesImpl {
+public class RegexRules
+    extends AbstractRulesImpl
+{
 
     // --------------------------------------------------------- Fields
-    
-    /** All registered <code>Rule</code>'s  */
+
+    /** All registered <code>Rule</code>'s */
     private ArrayList<RegisteredRule> registeredRules = new ArrayList<RegisteredRule>();
+
     /** The regex strategy used by this RegexRules */
     private RegexMatcher matcher;
 
@@ -45,69 +50,75 @@ public class RegexRules extends Abstract
 
     /**
      * Construct sets the Regex matching strategy.
-     *
+     * 
      * @param matcher the regex strategy to be used, not null
      * @throws IllegalArgumentException if the strategy is null
      */
-    public RegexRules(RegexMatcher matcher) {
-        setRegexMatcher(matcher);
+    public RegexRules( RegexMatcher matcher )
+    {
+        setRegexMatcher( matcher );
     }
 
     // --------------------------------------------------------- Properties
-    
-    /** 
+
+    /**
      * Gets the current regex matching strategy.
      */
-    public RegexMatcher getRegexMatcher() {
+    public RegexMatcher getRegexMatcher()
+    {
         return matcher;
     }
-    
-    /** 
+
+    /**
      * Sets the current regex matching strategy.
-     *
+     * 
      * @param matcher use this RegexMatcher, not null
      * @throws IllegalArgumentException if the strategy is null
      */
-    public void setRegexMatcher(RegexMatcher matcher) {
-        if (matcher == null) {
-            throw new IllegalArgumentException("RegexMatcher must not be null.");
+    public void setRegexMatcher( RegexMatcher matcher )
+    {
+        if ( matcher == null )
+        {
+            throw new IllegalArgumentException( "RegexMatcher must not be null." );
         }
         this.matcher = matcher;
     }
-    
+
     // --------------------------------------------------------- Public Methods
 
     /**
      * Register a new Rule instance matching the specified pattern.
-     *
+     * 
      * @param pattern Nesting pattern to be matched for this Rule
      * @param rule Rule instance to be registered
      */
     @Override
-    protected void registerRule(String pattern, Rule rule) {
-        registeredRules.add(new RegisteredRule(pattern, rule));
+    protected void registerRule( String pattern, Rule rule )
+    {
+        registeredRules.add( new RegisteredRule( pattern, rule ) );
     }
 
     /**
      * Clear all existing Rule instance registrations.
      */
     @Override
-    public void clear() {
+    public void clear()
+    {
         registeredRules.clear();
     }
 
     /**
-     * Finds matching rules by using current regex matching strategy.
-     * The rule associated with each path that matches is added to the list of matches.
-     * The order of matching rules is the same order that they were added.
-     *
-     * @param namespaceURI Namespace URI for which to select matching rules,
-     *  or <code>null</code> to match regardless of namespace URI
+     * Finds matching rules by using current regex matching strategy. The rule associated with each path that matches is
+     * added to the list of matches. The order of matching rules is the same order that they were added.
+     * 
+     * @param namespaceURI Namespace URI for which to select matching rules, or <code>null</code> to match regardless of
+     *            namespace URI
      * @param pattern Nesting pattern to be matched
      * @return a list of matching <code>Rule</code>'s
      */
     @Override
-    public List<Rule> match(String namespaceURI, String pattern) {
+    public List<Rule> match( String namespaceURI, String pattern )
+    {
         //
         // not a particularly quick implementation
         // regex is probably going to be slower than string equality
@@ -116,38 +127,42 @@ public class RegexRules extends Abstract
         //
         // XXX FIX ME - Time And Optimize
         //
-        ArrayList<Rule> rules = new ArrayList<Rule>(registeredRules.size());
-        for (RegisteredRule rr : registeredRules) {
-            if (matcher.match(pattern, rr.pattern)) {
-                rules.add(rr.rule);
+        ArrayList<Rule> rules = new ArrayList<Rule>( registeredRules.size() );
+        for ( RegisteredRule rr : registeredRules )
+        {
+            if ( matcher.match( pattern, rr.pattern ) )
+            {
+                rules.add( rr.rule );
             }
         }
         return rules;
     }
 
-
     /**
-     * Return a List of all registered Rule instances, or a zero-length List
-     * if there are no registered Rule instances.  If more than one Rule
-     * instance has been registered, they <strong>must</strong> be returned
-     * in the order originally registered through the <code>add()</code>
-     * method.
+     * Return a List of all registered Rule instances, or a zero-length List if there are no registered Rule instances.
+     * If more than one Rule instance has been registered, they <strong>must</strong> be returned in the order
+     * originally registered through the <code>add()</code> method.
      */
     @Override
-    public List<Rule> rules() {
-        ArrayList<Rule> rules = new ArrayList<Rule>(registeredRules.size());
-        for (RegisteredRule rr : registeredRules) {
-            rules.add(rr.rule);
+    public List<Rule> rules()
+    {
+        ArrayList<Rule> rules = new ArrayList<Rule>( registeredRules.size() );
+        for ( RegisteredRule rr : registeredRules )
+        {
+            rules.add( rr.rule );
         }
         return rules;
     }
-    
+
     /** Used to associate rules with paths in the rules list */
-    private class RegisteredRule {
+    private class RegisteredRule
+    {
         String pattern;
+
         Rule rule;
-        
-        RegisteredRule(String pattern, Rule rule) {
+
+        RegisteredRule( String pattern, Rule rule )
+        {
             this.pattern = pattern;
             this.rule = rule;
         }

Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/Rule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/Rule.java?rev=1102402&r1=1102401&r2=1102402&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/Rule.java (original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/Rule.java Thu May 12 18:03:26 2011
@@ -16,183 +16,159 @@
  * limitations under the License.
  */
 
-
 package org.apache.commons.digester3;
 
-
 import org.xml.sax.Attributes;
 
-
 /**
- * Concrete implementations of this class implement actions to be taken when
- * a corresponding nested pattern of XML elements has been matched.
+ * Concrete implementations of this class implement actions to be taken when a corresponding nested pattern of XML
+ * elements has been matched.
  * <p>
- * Writing a custom Rule is considered perfectly normal when using Digester,
- * and is encouraged whenever the default set of Rule classes don't meet your
- * requirements; the digester framework can help process xml even when the
- * built-in rules aren't quite what is needed. Creating a custom Rule is
- * just as easy as subclassing javax.servlet.http.HttpServlet for webapps,
- * or javax.swing.Action for GUI applications.
+ * Writing a custom Rule is considered perfectly normal when using Digester, and is encouraged whenever the default set
+ * of Rule classes don't meet your requirements; the digester framework can help process xml even when the built-in
+ * rules aren't quite what is needed. Creating a custom Rule is just as easy as subclassing
+ * javax.servlet.http.HttpServlet for webapps, or javax.swing.Action for GUI applications.
  * <p>
- * If a rule wishes to manipulate a digester stack (the default object stack,
- * a named stack, or the parameter stack) then it should only ever push
- * objects in the rule's begin method and always pop exactly the same
- * number of objects off the stack during the rule's end method. Of course
- * peeking at the objects on the stacks can be done from anywhere.
+ * If a rule wishes to manipulate a digester stack (the default object stack, a named stack, or the parameter stack)
+ * then it should only ever push objects in the rule's begin method and always pop exactly the same number of objects
+ * off the stack during the rule's end method. Of course peeking at the objects on the stacks can be done from anywhere.
  * <p>
- * Rule objects should be stateless, ie they should not update any instance
- * member during the parsing process. A rule instance that changes state
- * will encounter problems if invoked in a "nested" manner; this can happen
- * if the same instance is added to digester multiple times or if a 
- * wildcard pattern is used which can match both an element and a child of the
- * same element. The digester object stack and named stacks should be used to
- * store any state that a rule requires, making the rule class safe under all
- * possible uses.
+ * Rule objects should be stateless, ie they should not update any instance member during the parsing process. A rule
+ * instance that changes state will encounter problems if invoked in a "nested" manner; this can happen if the same
+ * instance is added to digester multiple times or if a wildcard pattern is used which can match both an element and a
+ * child of the same element. The digester object stack and named stacks should be used to store any state that a rule
+ * requires, making the rule class safe under all possible uses.
  */
 
-public abstract class Rule {
+public abstract class Rule
+{
 
     // ----------------------------------------------------- Instance Variables
 
-
     /**
      * The Digester with which this Rule is associated.
      */
     private Digester digester = null;
 
-
     /**
      * The namespace URI for which this Rule is relevant, if any.
      */
     private String namespaceURI = null;
 
-
     // ------------------------------------------------------------- Properties
 
-
     /**
      * Return the Digester with which this Rule is associated.
      */
-    public Digester getDigester() {
+    public Digester getDigester()
+    {
 
-        return (this.digester);
+        return ( this.digester );
 
     }
-    
+
     /**
      * Set the <code>Digester</code> with which this <code>Rule</code> is associated.
      */
-    public void setDigester(Digester digester) {
-        
+    public void setDigester( Digester digester )
+    {
+
         this.digester = digester;
-        
+
     }
 
     /**
      * Return the namespace URI for which this Rule is relevant, if any.
      */
-    public String getNamespaceURI() {
+    public String getNamespaceURI()
+    {
 
-        return (this.namespaceURI);
+        return ( this.namespaceURI );
 
     }
 
-
     /**
      * Set the namespace URI for which this Rule is relevant, if any.
-     *
-     * @param namespaceURI Namespace URI for which this Rule is relevant,
-     *  or <code>null</code> to match independent of namespace.
+     * 
+     * @param namespaceURI Namespace URI for which this Rule is relevant, or <code>null</code> to match independent of
+     *            namespace.
      */
-    public void setNamespaceURI(String namespaceURI) {
+    public void setNamespaceURI( String namespaceURI )
+    {
 
         this.namespaceURI = namespaceURI;
 
     }
 
-
     // --------------------------------------------------------- Public Methods
 
-
     /**
-     * This method is called when the beginning of a matching XML element
-     * is encountered. The default implementation delegates to the deprecated
-     * method {@link #begin(Attributes) begin} without the 
-     * <code>namespace</code> and <code>name</code> parameters, to retain 
-     * backwards compatibility.
-     *
-     * @param namespace the namespace URI of the matching element, or an 
-     *   empty string if the parser is not namespace aware or the element has
-     *   no namespace
-     * @param name the local name if the parser is namespace aware, or just 
-     *   the element name otherwise
+     * This method is called when the beginning of a matching XML element is encountered. The default implementation
+     * delegates to the deprecated method {@link #begin(Attributes) begin} without the <code>namespace</code> and
+     * <code>name</code> parameters, to retain backwards compatibility.
+     * 
+     * @param namespace the namespace URI of the matching element, or an empty string if the parser is not namespace
+     *            aware or the element has no namespace
+     * @param name the local name if the parser is namespace aware, or just the element name otherwise
      * @param attributes The attribute list of this element
      * @since Digester 1.4
      */
-    public void begin(String namespace, String name, Attributes attributes)
-        throws Exception {
+    public void begin( String namespace, String name, Attributes attributes )
+        throws Exception
+    {
 
         // The default implementation does nothing
 
     }
 
-
     /**
-     * This method is called when the body of a matching XML element is 
-     * encountered.  If the element has no body, this method is 
-     * called with an empty string as the body text.
+     * This method is called when the body of a matching XML element is encountered. If the element has no body, this
+     * method is called with an empty string as the body text.
      * <p>
-     * The default implementation delegates to the deprecated method 
-     * {@link #body(String) body} without the <code>namespace</code> and
-     * <code>name</code> parameters, to retain backwards compatibility.
-     *
-     * @param namespace the namespace URI of the matching element, or an 
-     *   empty string if the parser is not namespace aware or the element has
-     *   no namespace
-     * @param name the local name if the parser is namespace aware, or just 
-     *   the element name otherwise
+     * The default implementation delegates to the deprecated method {@link #body(String) body} without the
+     * <code>namespace</code> and <code>name</code> parameters, to retain backwards compatibility.
+     * 
+     * @param namespace the namespace URI of the matching element, or an empty string if the parser is not namespace
+     *            aware or the element has no namespace
+     * @param name the local name if the parser is namespace aware, or just the element name otherwise
      * @param text The text of the body of this element
      * @since Digester 1.4
      */
-    public void body(String namespace, String name, String text)
-        throws Exception {
+    public void body( String namespace, String name, String text )
+        throws Exception
+    {
 
         // The default implementation does nothing
 
     }
 
-
     /**
-     * This method is called when the end of a matching XML element
-     * is encountered. The default implementation delegates to the deprecated
-     * method {@link #end end} without the 
-     * <code>namespace</code> and <code>name</code> parameters, to retain 
-     * backwards compatibility.
-     *
-     * @param namespace the namespace URI of the matching element, or an 
-     *   empty string if the parser is not namespace aware or the element has
-     *   no namespace
-     * @param name the local name if the parser is namespace aware, or just 
-     *   the element name otherwise
+     * This method is called when the end of a matching XML element is encountered. The default implementation delegates
+     * to the deprecated method {@link #end end} without the <code>namespace</code> and <code>name</code> parameters, to
+     * retain backwards compatibility.
+     * 
+     * @param namespace the namespace URI of the matching element, or an empty string if the parser is not namespace
+     *            aware or the element has no namespace
+     * @param name the local name if the parser is namespace aware, or just the element name otherwise
      * @since Digester 1.4
      */
-    public void end(String namespace, String name)
-        throws Exception {
+    public void end( String namespace, String name )
+        throws Exception
+    {
 
         // The default implementation does nothing
 
     }
 
-
     /**
-     * This method is called after all parsing methods have been
-     * called, to allow Rules to remove temporary data.
+     * This method is called after all parsing methods have been called, to allow Rules to remove temporary data.
      */
-    public void finish() throws Exception {
+    public void finish()
+        throws Exception
+    {
 
         // The default implementation does nothing
 
     }
 
-
 }

Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/RuleSet.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/RuleSet.java?rev=1102402&r1=1102401&r2=1102402&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/RuleSet.java (original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/RuleSet.java Thu May 12 18:03:26 2011
@@ -18,50 +18,40 @@
 
 package org.apache.commons.digester3;
 
-
 /**
- * <p>Public interface defining a shorthand means of configuring a complete
- * set of related <code>Rule</code> definitions, possibly associated with
- * a particular namespace URI, in one operation.  To use an instance of a
- * class that imlements this interface:</p>
+ * <p>
+ * Public interface defining a shorthand means of configuring a complete set of related <code>Rule</code> definitions,
+ * possibly associated with a particular namespace URI, in one operation. To use an instance of a class that imlements
+ * this interface:
+ * </p>
  * <ul>
  * <li>Create a concrete implementation of this interface.</li>
- * <li>Optionally, you can configure a <code>RuleSet</code> to be relevant
- *     only for a particular namespace URI by configuring the value to be
- *     returned by <code>getNamespaceURI()</code>.</li>
- * <li>As you are configuring your Digester instance, call
- *     <code>digester.addRuleSet()</code> and pass the RuleSet instance.</li>
- * <li>Digester will call the <code>addRuleInstances()</code> method of
- *     your RuleSet to configure the necessary rules.</li>
+ * <li>Optionally, you can configure a <code>RuleSet</code> to be relevant only for a particular namespace URI by
+ * configuring the value to be returned by <code>getNamespaceURI()</code>.</li>
+ * <li>As you are configuring your Digester instance, call <code>digester.addRuleSet()</code> and pass the RuleSet
+ * instance.</li>
+ * <li>Digester will call the <code>addRuleInstances()</code> method of your RuleSet to configure the necessary rules.</li>
  * </ul>
  */
 
-public interface RuleSet {
-
+public interface RuleSet
+{
 
     // ------------------------------------------------------------- Properties
 
-
     /**
-     * Return the namespace URI that will be applied to all Rule instances
-     * created from this RuleSet.
+     * Return the namespace URI that will be applied to all Rule instances created from this RuleSet.
      */
     String getNamespaceURI();
 
-
     // --------------------------------------------------------- Public Methods
 
-
     /**
-     * Add the set of Rule instances defined in this RuleSet to the
-     * specified <code>Digester</code> instance, associating them with
-     * our namespace URI (if any).  This method should only be called
-     * by a Digester instance.
-     *
-     * @param digester Digester instance to which the new Rule instances
-     *  should be added.
+     * Add the set of Rule instances defined in this RuleSet to the specified <code>Digester</code> instance,
+     * associating them with our namespace URI (if any). This method should only be called by a Digester instance.
+     * 
+     * @param digester Digester instance to which the new Rule instances should be added.
      */
-    void addRuleInstances(Digester digester);
-
+    void addRuleInstances( Digester digester );
 
 }

Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/RuleSetBase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/RuleSetBase.java?rev=1102402&r1=1102401&r2=1102402&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/RuleSetBase.java (original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/RuleSetBase.java Thu May 12 18:03:26 2011
@@ -16,56 +16,46 @@
  * limitations under the License.
  */
 
-
 package org.apache.commons.digester3;
 
-
 /**
- * <p>Convenience base class that implements the {@link RuleSet} interface.
- * Concrete implementations should list all of their actual rule creation
- * logic in the <code>addRuleSet()</code> implementation.</p>
+ * <p>
+ * Convenience base class that implements the {@link RuleSet} interface. Concrete implementations should list all of
+ * their actual rule creation logic in the <code>addRuleSet()</code> implementation.
+ * </p>
  */
 
-public abstract class RuleSetBase implements RuleSet {
-
+public abstract class RuleSetBase
+    implements RuleSet
+{
 
     // ----------------------------------------------------- Instance Variables
 
-
     /**
-     * The namespace URI that all Rule instances created by this RuleSet
-     * will be associated with.
+     * The namespace URI that all Rule instances created by this RuleSet will be associated with.
      */
     protected String namespaceURI = null;
 
-
     // ------------------------------------------------------------- Properties
 
-
     /**
-     * Return the namespace URI that will be applied to all Rule instances
-     * created from this RuleSet.
+     * Return the namespace URI that will be applied to all Rule instances created from this RuleSet.
      */
-    public String getNamespaceURI() {
+    public String getNamespaceURI()
+    {
 
-        return (this.namespaceURI);
+        return ( this.namespaceURI );
 
     }
 
-
     // --------------------------------------------------------- Public Methods
 
-
     /**
-     * Add the set of Rule instances defined in this RuleSet to the
-     * specified <code>Digester</code> instance, associating them with
-     * our namespace URI (if any).  This method should only be called
-     * by a Digester instance.
-     *
-     * @param digester Digester instance to which the new Rule instances
-     *  should be added.
+     * Add the set of Rule instances defined in this RuleSet to the specified <code>Digester</code> instance,
+     * associating them with our namespace URI (if any). This method should only be called by a Digester instance.
+     * 
+     * @param digester Digester instance to which the new Rule instances should be added.
      */
-    public abstract void addRuleInstances(Digester digester);
-
+    public abstract void addRuleInstances( Digester digester );
 
 }

Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/Rules.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/Rules.java?rev=1102402&r1=1102401&r2=1102402&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/Rules.java (original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/Rules.java Thu May 12 18:03:26 2011
@@ -16,114 +16,88 @@
  * limitations under the License.
  */
 
-
 package org.apache.commons.digester3;
 
-
 import java.util.List;
 
-
 /**
- * Public interface defining a collection of Rule instances (and corresponding
- * matching patterns) plus an implementation of a matching policy that selects
- * the rules that match a particular pattern of nested elements discovered
- * during parsing.
+ * Public interface defining a collection of Rule instances (and corresponding matching patterns) plus an implementation
+ * of a matching policy that selects the rules that match a particular pattern of nested elements discovered during
+ * parsing.
  */
 
-public interface Rules {
-
+public interface Rules
+{
 
     // ------------------------------------------------------------- Properties
 
-
     /**
-     * Return the Digester instance with which this Rules instance is
-     * associated.
+     * Return the Digester instance with which this Rules instance is associated.
      */
     public Digester getDigester();
 
-
     /**
      * Set the Digester instance with which this Rules instance is associated.
-     *
+     * 
      * @param digester The newly associated Digester instance
      */
-    public void setDigester(Digester digester);
-
+    public void setDigester( Digester digester );
 
     /**
-     * Return the namespace URI that will be applied to all subsequently
-     * added <code>Rule</code> objects.
+     * Return the namespace URI that will be applied to all subsequently added <code>Rule</code> objects.
      */
     public String getNamespaceURI();
 
-
     /**
-     * Set the namespace URI that will be applied to all subsequently
-     * added <code>Rule</code> objects.
-     *
-     * @param namespaceURI Namespace URI that must match on all
-     *  subsequently added rules, or <code>null</code> for matching
-     *  regardless of the current namespace URI
+     * Set the namespace URI that will be applied to all subsequently added <code>Rule</code> objects.
+     * 
+     * @param namespaceURI Namespace URI that must match on all subsequently added rules, or <code>null</code> for
+     *            matching regardless of the current namespace URI
      */
-    public void setNamespaceURI(String namespaceURI);
-
+    public void setNamespaceURI( String namespaceURI );
 
     // --------------------------------------------------------- Public Methods
 
-
     /**
      * Register a new Rule instance matching the specified pattern.
-     *
+     * 
      * @param pattern Nesting pattern to be matched for this Rule
      * @param rule Rule instance to be registered
      */
-    public void add(String pattern, Rule rule);
-
+    public void add( String pattern, Rule rule );
 
     /**
      * Clear all existing Rule instance registrations.
      */
     public void clear();
 
-
     /**
-     * Return a List of all registered Rule instances that match the specified
-     * nesting pattern, or a zero-length List if there are no matches.  If more
-     * than one Rule instance matches, they <strong>must</strong> be returned
-     * in the order originally registered through the <code>add()</code>
-     * method.
-     *
+     * Return a List of all registered Rule instances that match the specified nesting pattern, or a zero-length List if
+     * there are no matches. If more than one Rule instance matches, they <strong>must</strong> be returned in the order
+     * originally registered through the <code>add()</code> method.
+     * 
      * @param pattern Nesting pattern to be matched
-     *
      * @deprecated Call match(namespaceURI,pattern) instead.
      */
     @Deprecated
-    public List<Rule> match(String pattern);
-
+    public List<Rule> match( String pattern );
 
     /**
-     * Return a List of all registered Rule instances that match the specified
-     * nesting pattern, or a zero-length List if there are no matches.  If more
-     * than one Rule instance matches, they <strong>must</strong> be returned
-     * in the order originally registered through the <code>add()</code>
-     * method.
-     *
-     * @param namespaceURI Namespace URI for which to select matching rules,
-     *  or <code>null</code> to match regardless of namespace URI
+     * Return a List of all registered Rule instances that match the specified nesting pattern, or a zero-length List if
+     * there are no matches. If more than one Rule instance matches, they <strong>must</strong> be returned in the order
+     * originally registered through the <code>add()</code> method.
+     * 
+     * @param namespaceURI Namespace URI for which to select matching rules, or <code>null</code> to match regardless of
+     *            namespace URI
      * @param pattern Nesting pattern to be matched
      */
-    public List<Rule> match(String namespaceURI, String pattern);
-
+    public List<Rule> match( String namespaceURI, String pattern );
 
     /**
-     * Return a List of all registered Rule instances, or a zero-length List
-     * if there are no registered Rule instances.  If more than one Rule
-     * instance has been registered, they <strong>must</strong> be returned
-     * in the order originally registered through the <code>add()</code>
-     * method.
+     * Return a List of all registered Rule instances, or a zero-length List if there are no registered Rule instances.
+     * If more than one Rule instance has been registered, they <strong>must</strong> be returned in the order
+     * originally registered through the <code>add()</code> method.
      */
     public List<Rule> rules();
 
-
 }

Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/RulesBase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/RulesBase.java?rev=1102402&r1=1102401&r2=1102402&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/RulesBase.java (original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/RulesBase.java Thu May 12 18:03:26 2011
@@ -16,280 +16,266 @@
  * limitations under the License.
  */
 
-
 package org.apache.commons.digester3;
 
-
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 
-
 /**
- * <p>Default implementation of the <code>Rules</code> interface that supports
- * the standard rule matching behavior.  This class can also be used as a
- * base class for specialized <code>Rules</code> implementations.</p>
- *
- * <p>The matching policies implemented by this class support two different
- * types of pattern matching rules:</p>
+ * <p>
+ * Default implementation of the <code>Rules</code> interface that supports the standard rule matching behavior. This
+ * class can also be used as a base class for specialized <code>Rules</code> implementations.
+ * </p>
+ * <p>
+ * The matching policies implemented by this class support two different types of pattern matching rules:
+ * </p>
  * <ul>
- * <li><em>Exact Match</em> - A pattern "a/b/c" exactly matches a
- *     <code>&lt;c&gt;</code> element, nested inside a <code>&lt;b&gt;</code>
- *     element, which is nested inside an <code>&lt;a&gt;</code> element.</li>
- * <li><em>Tail Match</em> - A pattern "&#42;/a/b" matches a
- *     <code>&lt;b&gt;</code> element, nested inside an <code>&lt;a&gt;</code>
- *      element, no matter how deeply the pair is nested.</li>
+ * <li><em>Exact Match</em> - A pattern "a/b/c" exactly matches a <code>&lt;c&gt;</code> element, nested inside a
+ * <code>&lt;b&gt;</code> element, which is nested inside an <code>&lt;a&gt;</code> element.</li>
+ * <li><em>Tail Match</em> - A pattern "&#42;/a/b" matches a <code>&lt;b&gt;</code> element, nested inside an
+ * <code>&lt;a&gt;</code> element, no matter how deeply the pair is nested.</li>
  * </ul>
- *
- * <p>Note that wildcard patterns are ignored if an explicit match can be found 
- * (and when multiple wildcard patterns match, only the longest, ie most 
- * explicit, pattern is considered a match).</p>
- *
- * <p>See the package documentation for package org.apache.commons.digester3 
- * for more information.</p>
+ * <p>
+ * Note that wildcard patterns are ignored if an explicit match can be found (and when multiple wildcard patterns match,
+ * only the longest, ie most explicit, pattern is considered a match).
+ * </p>
+ * <p>
+ * See the package documentation for package org.apache.commons.digester3 for more information.
+ * </p>
  */
 
-public class RulesBase implements Rules {
-
+public class RulesBase
+    implements Rules
+{
 
     // ----------------------------------------------------- Instance Variables
 
-
     /**
-     * The set of registered Rule instances, keyed by the matching pattern.
-     * Each value is a List containing the Rules for that pattern, in the
-     * order that they were orginally registered.
+     * The set of registered Rule instances, keyed by the matching pattern. Each value is a List containing the Rules
+     * for that pattern, in the order that they were orginally registered.
      */
     protected HashMap<String, List<Rule>> cache = new HashMap<String, List<Rule>>();
 
-
     /**
      * The Digester instance with which this Rules instance is associated.
      */
     protected Digester digester = null;
 
-
     /**
-     * The namespace URI for which subsequently added <code>Rule</code>
-     * objects are relevant, or <code>null</code> for matching independent
-     * of namespaces.
+     * The namespace URI for which subsequently added <code>Rule</code> objects are relevant, or <code>null</code> for
+     * matching independent of namespaces.
      */
     protected String namespaceURI = null;
 
-
     /**
-     * The set of registered Rule instances, in the order that they were
-     * originally registered.
+     * The set of registered Rule instances, in the order that they were originally registered.
      */
     protected ArrayList<Rule> rules = new ArrayList<Rule>();
 
-
     // ------------------------------------------------------------- Properties
 
-
     /**
-     * Return the Digester instance with which this Rules instance is
-     * associated.
+     * Return the Digester instance with which this Rules instance is associated.
      */
-    public Digester getDigester() {
+    public Digester getDigester()
+    {
 
-        return (this.digester);
+        return ( this.digester );
 
     }
 
-
     /**
      * Set the Digester instance with which this Rules instance is associated.
-     *
+     * 
      * @param digester The newly associated Digester instance
      */
-    public void setDigester(Digester digester) {
+    public void setDigester( Digester digester )
+    {
 
         this.digester = digester;
-        for (Rule rule : rules) {
-            rule.setDigester(digester);
+        for ( Rule rule : rules )
+        {
+            rule.setDigester( digester );
         }
 
     }
 
-
     /**
-     * Return the namespace URI that will be applied to all subsequently
-     * added <code>Rule</code> objects.
+     * Return the namespace URI that will be applied to all subsequently added <code>Rule</code> objects.
      */
-    public String getNamespaceURI() {
+    public String getNamespaceURI()
+    {
 
-        return (this.namespaceURI);
+        return ( this.namespaceURI );
 
     }
 
-
     /**
-     * Set the namespace URI that will be applied to all subsequently
-     * added <code>Rule</code> objects.
-     *
-     * @param namespaceURI Namespace URI that must match on all
-     *  subsequently added rules, or <code>null</code> for matching
-     *  regardless of the current namespace URI
+     * Set the namespace URI that will be applied to all subsequently added <code>Rule</code> objects.
+     * 
+     * @param namespaceURI Namespace URI that must match on all subsequently added rules, or <code>null</code> for
+     *            matching regardless of the current namespace URI
      */
-    public void setNamespaceURI(String namespaceURI) {
+    public void setNamespaceURI( String namespaceURI )
+    {
 
         this.namespaceURI = namespaceURI;
 
     }
 
-
     // --------------------------------------------------------- Public Methods
 
-
     /**
      * Register a new Rule instance matching the specified pattern.
-     *
+     * 
      * @param pattern Nesting pattern to be matched for this Rule
      * @param rule Rule instance to be registered
      */
-    public void add(String pattern, Rule rule) {
+    public void add( String pattern, Rule rule )
+    {
         // to help users who accidently add '/' to the end of their patterns
         int patternLength = pattern.length();
-        if (patternLength>1 && pattern.endsWith("/")) {
-            pattern = pattern.substring(0, patternLength-1);
+        if ( patternLength > 1 && pattern.endsWith( "/" ) )
+        {
+            pattern = pattern.substring( 0, patternLength - 1 );
         }
-        
-        
-        List<Rule> list = cache.get(pattern);
-        if (list == null) {
+
+        List<Rule> list = cache.get( pattern );
+        if ( list == null )
+        {
             list = new ArrayList<Rule>();
-            cache.put(pattern, list);
+            cache.put( pattern, list );
         }
-        list.add(rule);
-        rules.add(rule);
-        if (this.digester != null) {
-            rule.setDigester(this.digester);
+        list.add( rule );
+        rules.add( rule );
+        if ( this.digester != null )
+        {
+            rule.setDigester( this.digester );
         }
-        if (this.namespaceURI != null) {
-            rule.setNamespaceURI(this.namespaceURI);
+        if ( this.namespaceURI != null )
+        {
+            rule.setNamespaceURI( this.namespaceURI );
         }
 
     }
 
-
     /**
      * Clear all existing Rule instance registrations.
      */
-    public void clear() {
+    public void clear()
+    {
 
         cache.clear();
         rules.clear();
 
     }
 
-
     /**
-     * Return a List of all registered Rule instances that match the specified
-     * nesting pattern, or a zero-length List if there are no matches.  If more
-     * than one Rule instance matches, they <strong>must</strong> be returned
-     * in the order originally registered through the <code>add()</code>
-     * method.
-     *
+     * Return a List of all registered Rule instances that match the specified nesting pattern, or a zero-length List if
+     * there are no matches. If more than one Rule instance matches, they <strong>must</strong> be returned in the order
+     * originally registered through the <code>add()</code> method.
+     * 
      * @param pattern Nesting pattern to be matched
-     *
      * @deprecated Call match(namespaceURI,pattern) instead.
      */
     @Deprecated
-    public List<Rule> match(String pattern) {
+    public List<Rule> match( String pattern )
+    {
 
-        return (match(null, pattern));
+        return ( match( null, pattern ) );
 
     }
 
-
     /**
-     * Return a List of all registered Rule instances that match the specified
-     * nesting pattern, or a zero-length List if there are no matches.  If more
-     * than one Rule instance matches, they <strong>must</strong> be returned
-     * in the order originally registered through the <code>add()</code>
-     * method.
-     *
-     * @param namespaceURI Namespace URI for which to select matching rules,
-     *  or <code>null</code> to match regardless of namespace URI
+     * Return a List of all registered Rule instances that match the specified nesting pattern, or a zero-length List if
+     * there are no matches. If more than one Rule instance matches, they <strong>must</strong> be returned in the order
+     * originally registered through the <code>add()</code> method.
+     * 
+     * @param namespaceURI Namespace URI for which to select matching rules, or <code>null</code> to match regardless of
+     *            namespace URI
      * @param pattern Nesting pattern to be matched
      */
-    public List<Rule> match(String namespaceURI, String pattern) {
+    public List<Rule> match( String namespaceURI, String pattern )
+    {
 
         // List rulesList = (List) this.cache.get(pattern);
-        List<Rule> rulesList = lookup(namespaceURI, pattern);
-        if ((rulesList == null) || (rulesList.size() < 1)) {
+        List<Rule> rulesList = lookup( namespaceURI, pattern );
+        if ( ( rulesList == null ) || ( rulesList.size() < 1 ) )
+        {
             // Find the longest key, ie more discriminant
             String longKey = "";
-            for (String key : cache.keySet()) {
-                if (key.startsWith("*/")) {
-                    if (pattern.equals(key.substring(2)) ||
-                        pattern.endsWith(key.substring(1))) {
-                        if (key.length() > longKey.length()) {
+            for ( String key : cache.keySet() )
+            {
+                if ( key.startsWith( "*/" ) )
+                {
+                    if ( pattern.equals( key.substring( 2 ) ) || pattern.endsWith( key.substring( 1 ) ) )
+                    {
+                        if ( key.length() > longKey.length() )
+                        {
                             // rulesList = (List) this.cache.get(key);
-                            rulesList = lookup(namespaceURI, key);
+                            rulesList = lookup( namespaceURI, key );
                             longKey = key;
                         }
                     }
                 }
             }
         }
-        if (rulesList == null) {
+        if ( rulesList == null )
+        {
             rulesList = new ArrayList<Rule>();
         }
-        return (rulesList);
+        return ( rulesList );
 
     }
 
-
     /**
-     * Return a List of all registered Rule instances, or a zero-length List
-     * if there are no registered Rule instances.  If more than one Rule
-     * instance has been registered, they <strong>must</strong> be returned
-     * in the order originally registered through the <code>add()</code>
-     * method.
+     * Return a List of all registered Rule instances, or a zero-length List if there are no registered Rule instances.
+     * If more than one Rule instance has been registered, they <strong>must</strong> be returned in the order
+     * originally registered through the <code>add()</code> method.
      */
-    public List<Rule> rules() {
+    public List<Rule> rules()
+    {
 
-        return (this.rules);
+        return ( this.rules );
 
     }
 
-
     // ------------------------------------------------------ Protected Methods
 
-
     /**
-     * Return a List of Rule instances for the specified pattern that also
-     * match the specified namespace URI (if any).  If there are no such
-     * rules, return <code>null</code>.
-     *
-     * @param namespaceURI Namespace URI to match, or <code>null</code> to
-     *  select matching rules regardless of namespace URI
+     * Return a List of Rule instances for the specified pattern that also match the specified namespace URI (if any).
+     * If there are no such rules, return <code>null</code>.
+     * 
+     * @param namespaceURI Namespace URI to match, or <code>null</code> to select matching rules regardless of namespace
+     *            URI
      * @param pattern Pattern to be matched
      */
-    protected List<Rule> lookup(String namespaceURI, String pattern) {
+    protected List<Rule> lookup( String namespaceURI, String pattern )
+    {
 
         // Optimize when no namespace URI is specified
-        List<Rule> list = this.cache.get(pattern);
-        if (list == null) {
-            return (null);
+        List<Rule> list = this.cache.get( pattern );
+        if ( list == null )
+        {
+            return ( null );
         }
-        if ((namespaceURI == null) || (namespaceURI.length() == 0)) {
-            return (list);
+        if ( ( namespaceURI == null ) || ( namespaceURI.length() == 0 ) )
+        {
+            return ( list );
         }
 
         // Select only Rules that match on the specified namespace URI
         ArrayList<Rule> results = new ArrayList<Rule>();
-        for (Rule item : list) {
-            if ((namespaceURI.equals(item.getNamespaceURI())) ||
-                    (item.getNamespaceURI() == null)) {
-                results.add(item);
+        for ( Rule item : list )
+        {
+            if ( ( namespaceURI.equals( item.getNamespaceURI() ) ) || ( item.getNamespaceURI() == null ) )
+            {
+                results.add( item );
             }
         }
-        return (results);
+        return ( results );
 
     }
 
-
 }