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 20:25:16 UTC

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

Author: simonetripodi
Date: Sun May 15 18:25:16 2011
New Revision: 1103497

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

Added:
    commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/binder/SetTopBuilder.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=1103497&r1=1103496&r2=1103497&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 18:25:16 2011
@@ -201,6 +201,21 @@ public final class LinkedRuleBuilder
     }
 
     /**
+     * Calls a "set top" method on the top (child) object, passing the (top-1) (parent) object as an argument.
+     *
+     * @param methodName Method name of the "set parent" method to call
+     */
+    public SetTopBuilder setTop( String methodName )
+    {
+        if ( methodName == null || methodName.length() == 0 )
+        {
+            mainBinder.addError( "{ forPattern( \"%s\" ).setTop( String ) } empty 'methodName' not allowed", keyPattern );
+        }
+
+        return addProvider( new SetTopBuilder( keyPattern, namespaceURI, mainBinder, this, methodName, classLoader ) );
+    }
+
+    /**
      * Add a custom user rule in the specified pattern built by the given provider.
      *
      * @param <R>

Added: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/binder/SetTopBuilder.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/binder/SetTopBuilder.java?rev=1103497&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/binder/SetTopBuilder.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/binder/SetTopBuilder.java Sun May 15 18:25:16 2011
@@ -0,0 +1,48 @@
+/* $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.SetTopRule;
+
+/**
+ * Builder chained when invoking {@link LinkedRuleBuilder#setTop(String)}.
+ *
+ * @since 3.0
+ */
+public final class SetTopBuilder
+    extends AbstractParamTypeBuilder<SetTopRule>
+{
+
+    SetTopBuilder( String keyPattern, String namespaceURI, RulesBinder mainBinder,
+                           LinkedRuleBuilder mainBuilder, String methodName, ClassLoader classLoader )
+    {
+        super( keyPattern, namespaceURI, mainBinder, mainBuilder, methodName, classLoader );
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    protected SetTopRule createRule()
+    {
+        SetTopRule rule = new SetTopRule( getMethodName(), getParamType().getName() );
+        rule.setExactMatch( isUseExactMatch() );
+        return rule;
+    }
+
+}

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

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

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