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/15 16:25:51 UTC

svn commit: r1103392 - in /commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/binder: LinkedRuleBuilder.java PathCallParamBuilder.java

Author: simonetripodi
Date: Sun May 15 14:25:50 2011
New Revision: 1103392

URL: http://svn.apache.org/viewvc?rev=1103392&view=rev
Log:
restored the PathCallParamBuilder class
PathCallParamBuilder plugged in the Digester EDSL

Added:
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/binder/PathCallParamBuilder.java   (with props)
Modified:
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/binder/LinkedRuleBuilder.java

Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/binder/LinkedRuleBuilder.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/binder/LinkedRuleBuilder.java?rev=1103392&r1=1103391&r2=1103392&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/binder/LinkedRuleBuilder.java (original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/binder/LinkedRuleBuilder.java Sun May 15 14:25:50 2011
@@ -82,6 +82,13 @@ public final class LinkedRuleBuilder
     }
 
     /**
+     * Construct a "call parameter" rule that will save the body text of this element as the parameter value.
+     */
+    public PathCallParamBuilder callParamPath() {
+        return this.addProvider(new PathCallParamBuilder(this.keyPattern, this.namespaceURI, this.mainBinder, this));
+    }
+
+    /**
      * Uses an {@link ObjectCreationFactory} to create a new object which it pushes onto the object stack.
      *
      * When the element is complete, the object will be popped.

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/binder/PathCallParamBuilder.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/binder/PathCallParamBuilder.java?rev=1103392&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/binder/PathCallParamBuilder.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/binder/PathCallParamBuilder.java Sun May 15 14:25:50 2011
@@ -0,0 +1,64 @@
+/* $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.digester3.binder;
+
+import org.apache.commons.digester3.PathCallParamRule;
+
+/**
+ * Builder chained when invoking {@link LinkedRuleBuilder#callParamPath()}.
+ *
+ * @since 3.0
+ */
+public final class PathCallParamBuilder
+    extends AbstractBackToLinkedRuleBuilder<PathCallParamRule>
+{
+
+    private int paramIndex = 0;
+
+    PathCallParamBuilder( String keyPattern, String namespaceURI, RulesBinder mainBinder, LinkedRuleBuilder mainBuilder )
+    {
+        super( keyPattern, namespaceURI, mainBinder, mainBuilder );
+    }
+
+    /**
+     * Sets the zero-relative parameter number.
+     *
+     * @param paramIndex The zero-relative parameter number
+     * @return this builder instance
+     */
+    public PathCallParamBuilder ofIndex( int paramIndex )
+    {
+        if ( paramIndex < 0 )
+        {
+            reportError( "callParamPath().ofIndex( int )", "negative index argument not allowed" );
+        }
+
+        this.paramIndex = paramIndex;
+        return this;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected PathCallParamRule createRule()
+    {
+        return new PathCallParamRule(this.paramIndex);
+    }
+
+}

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/binder/PathCallParamBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/binder/PathCallParamBuilder.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/binder/PathCallParamBuilder.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain