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/06/27 02:24:21 UTC
svn commit: r1139978 -
/commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/RulesBase.java
Author: simonetripodi
Date: Mon Jun 27 00:24:20 2011
New Revision: 1139978
URL: http://svn.apache.org/viewvc?rev=1139978&view=rev
Log:
removed duplicated code simply by inheriting from the abstract Rules implementation
Modified:
commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/RulesBase.java
Modified: commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/RulesBase.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/RulesBase.java?rev=1139978&r1=1139977&r2=1139978&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/RulesBase.java (original)
+++ commons/proper/digester/trunk/src/main/java/org/apache/commons/digester3/RulesBase.java Mon Jun 27 00:24:20 2011
@@ -49,7 +49,7 @@ import org.xml.sax.Attributes;
*/
public class RulesBase
- implements Rules
+ extends AbstractRulesImpl
{
// ----------------------------------------------------- Instance Variables
@@ -61,17 +61,6 @@ public class RulesBase
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.
- */
- protected String namespaceURI = null;
-
- /**
* The set of registered Rule instances, in the order that they were originally registered.
*/
protected ArrayList<Rule> rules = new ArrayList<Rule>();
@@ -81,45 +70,23 @@ public class RulesBase
/**
* {@inheritDoc}
*/
- public Digester getDigester()
- {
- return ( this.digester );
- }
-
- /**
- * {@inheritDoc}
- */
+ @Override
public void setDigester( Digester digester )
{
- this.digester = digester;
+ super.setDigester( digester );
for ( Rule rule : rules )
{
rule.setDigester( digester );
}
}
- /**
- * {@inheritDoc}
- */
- public String getNamespaceURI()
- {
- return ( this.namespaceURI );
- }
-
- /**
- * {@inheritDoc}
- */
- public void setNamespaceURI( String namespaceURI )
- {
- this.namespaceURI = namespaceURI;
- }
-
// --------------------------------------------------------- Public Methods
/**
* {@inheritDoc}
*/
- public void add( String pattern, Rule rule )
+ @Override
+ protected void registerRule( String pattern, Rule rule )
{
// to help users who accidently add '/' to the end of their patterns
int patternLength = pattern.length();
@@ -136,14 +103,6 @@ public class RulesBase
}
list.add( rule );
rules.add( rule );
- if ( this.digester != null )
- {
- rule.setDigester( this.digester );
- }
- if ( this.namespaceURI != null )
- {
- rule.setNamespaceURI( this.namespaceURI );
- }
}
/**