commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1065810 - /commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/RulesBinderImpl.java
Date Mon, 31 Jan 2011 21:43:20 GMT
Author: simonetripodi
Date: Mon Jan 31 21:43:19 2011
New Revision: 1065810

URL: http://svn.apache.org/viewvc?rev=1065810&view=rev
Log:
added setProperty() method implementation

Modified:
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/RulesBinderImpl.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=1065810&r1=1065809&r2=1065810&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
Mon Jan 31 21:43:19 2011
@@ -195,8 +195,39 @@ final class RulesBinderImpl implements R
                 });
             }
 
-            public SetPropertyBuilder setProperty(String attributePropertyName) {
-                return null;
+            /**
+             * 
+             */
+            public SetPropertyBuilder setProperty(final String attributePropertyName) {
+                if (attributePropertyName == null || attributePropertyName.length() == 0)
{
+                    addError("{forPattern(\"%s\").setProperty(String)} empty 'attributePropertyName'
not allowed",
+                            keyPattern);
+                }
+
+                return this.addProvider(new SetPropertyBuilder() {
+
+                    private String valueAttributeName;
+
+                    public SetPropertyRule get() {
+                        return setNamespaceAndReturn(new SetPropertyRule(attributePropertyName,
valueAttributeName));
+                    }
+
+                    public LinkedRuleBuilder then() {
+                        return mainBuilder;
+                    }
+
+                    public SetPropertyBuilder extractingValueFromAttribute(String valueAttributeName)
{
+                        if (attributePropertyName == null || attributePropertyName.length()
== 0) {
+                            addError("{forPattern(\"%s\").setProperty(\"%s\")} empty 'valueAttributeName'
not allowed",
+                                    keyPattern,
+                                    attributePropertyName);
+                        }
+
+                        this.valueAttributeName = valueAttributeName;
+                        return this;
+                    }
+
+                });
             }
 
             /**



Mime
View raw message