commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1068538 - in /commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3: RulesBinderImpl.java rulesbinder/NestedPropertiesBuilder.java
Date Tue, 08 Feb 2011 19:27:38 GMT
Author: simonetripodi
Date: Tue Feb  8 19:27:38 2011
New Revision: 1068538

URL: http://svn.apache.org/viewvc?rev=1068538&view=rev
Log:
added method to ignore a child XML element when SetNestedPropertiesRule
when explicitly specifying an alias on SetNestedPropertiesRule, null values are not allowed

Modified:
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/RulesBinderImpl.java
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/NestedPropertiesBuilder.java

Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/RulesBinderImpl.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/RulesBinderImpl.java?rev=1068538&r1=1068537&r2=1068538&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/RulesBinderImpl.java
(original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/RulesBinderImpl.java
Tue Feb  8 19:27:38 2011
@@ -320,12 +320,27 @@ final class RulesBinderImpl implements R
                         return this;
                     }
 
+                    public NestedPropertiesBuilder ignoreElement(String elementName) {
+                        if (elementName == null) {
+                            addError("{forPattern(\"%s\").setNestedProperties().ignoreElement(String)}
empty 'elementName' not allowed",
+                                    keyPattern);
+                        } else {
+                            this.elementNames.put(elementName, null);
+                        }
+                        return this;
+                    }
+
                     public NestedPropertiesBuilder addAlias(String elementName, String propertyName)
{
                         if (elementName == null) {
-                            addError("{forPattern(\"%s\").setNestedProperties().addAlias(String,String)}
empty 'methodName' not allowed",
+                            addError("{forPattern(\"%s\").setNestedProperties().addAlias(String,String)}
empty 'elementName' not allowed",
                                     keyPattern);
                         } else {
-                            this.elementNames.put(elementName, propertyName);
+                            if (propertyName == null) {
+                                addError("{forPattern(\"%s\").setNestedProperties().addAlias(String,String)}
empty 'propertyName' not allowed",
+                                        keyPattern);
+                            } else {
+                                this.elementNames.put(elementName, propertyName);
+                            }
                         }
                         return this;
                     }

Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/NestedPropertiesBuilder.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/NestedPropertiesBuilder.java?rev=1068538&r1=1068537&r2=1068538&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/NestedPropertiesBuilder.java
(original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/rulesbinder/NestedPropertiesBuilder.java
Tue Feb  8 19:27:38 2011
@@ -25,6 +25,14 @@ import org.apache.commons.digester3.SetN
 public interface NestedPropertiesBuilder extends BackToLinkedRuleBuilder<SetNestedPropertiesRule>
{
 
     /**
+     * Allows ignore a matching element.
+     *
+     * @param elementName The child xml element to be ignored
+     * @return this builder instance
+     */
+    NestedPropertiesBuilder ignoreElement(String elementName);
+
+    /**
      * Allows element2property mapping to be overridden.
      *
      * @param elementName The child xml element to match



Mime
View raw message