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/12 22:02:02 UTC

svn commit: r1102447 - in /commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/binder: AbstractRulesModule.java LinkedRuleBuilder.java RulesBinder.java

Author: simonetripodi
Date: Thu May 12 20:02:02 2011
New Revision: 1102447

URL: http://svn.apache.org/viewvc?rev=1102447&view=rev
Log:
first checkin of LinkedRuleBuilder
LinkedRuleBuilderplugged in the RulesBinder

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

Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/binder/AbstractRulesModule.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/binder/AbstractRulesModule.java?rev=1102447&r1=1102446&r2=1102447&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/binder/AbstractRulesModule.java (original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/binder/AbstractRulesModule.java Thu May 12 20:02:02 2011
@@ -79,6 +79,14 @@ public abstract class AbstractRulesModul
     }
 
     /**
+     * @see RulesBinder#forPattern(String)
+     */
+    protected LinkedRuleBuilder forPattern( String pattern )
+    {
+        return new LinkedRuleBuilder();
+    }
+
+    /**
      * Return the wrapped {@link RulesBinder}.
      *
      * @return The wrapped {@link RulesBinder}

Added: 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=1102447&view=auto
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/binder/LinkedRuleBuilder.java (added)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/binder/LinkedRuleBuilder.java Thu May 12 20:02:02 2011
@@ -0,0 +1,51 @@
+/* $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;
+
+/**
+ * Builder invoked to bind one or more rules to a pattern.
+ *
+ * @since 3.0
+ */
+public final class LinkedRuleBuilder
+{
+
+    private String namespaceURI;
+
+    /**
+     * Sets the namespace URI for the current rule pattern.
+     *
+     * @param namespaceURI the namespace URI associated to the rule pattern.
+     * @return this {@link LinkedRuleBuilder} instance
+     */
+    public LinkedRuleBuilder withNamespaceURI( /* @Nullable */String namespaceURI )
+    {
+        if ( namespaceURI == null || namespaceURI.length() > 0 )
+        {
+            this.namespaceURI = namespaceURI;
+        }
+        else
+        {
+            // ignore empty namespaces, null is better
+            this.namespaceURI = null;
+        }
+
+        return this;
+    }
+
+}

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

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

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

Modified: commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/binder/RulesBinder.java
URL: http://svn.apache.org/viewvc/commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/binder/RulesBinder.java?rev=1102447&r1=1102446&r2=1102447&view=diff
==============================================================================
--- commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/binder/RulesBinder.java (original)
+++ commons/sandbox/digester3/trunk/src/main/java/org/apache/commons/digester3/binder/RulesBinder.java Thu May 12 20:02:02 2011
@@ -51,4 +51,12 @@ public interface RulesBinder
      */
     void install( RulesModule rulesModule );
 
+    /**
+     * Allows to associate the given pattern to one or more Digester rules.
+     *
+     * @param pattern The pattern that this rule should match
+     * @return The Digester rules builder
+     */
+    LinkedRuleBuilder forPattern( String pattern );
+
 }