View Javadoc

1   package org.apache.commons.digester3;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  /**
23   * <p>
24   * Public interface defining a shorthand means of configuring a complete set of related <code>Rule</code> definitions,
25   * possibly associated with a particular namespace URI, in one operation. To use an instance of a class that imlements
26   * this interface:
27   * </p>
28   * <ul>
29   * <li>Create a concrete implementation of this interface.</li>
30   * <li>Optionally, you can configure a <code>RuleSet</code> to be relevant only for a particular namespace URI by
31   * configuring the value to be returned by <code>getNamespaceURI()</code>.</li>
32   * <li>As you are configuring your Digester instance, call <code>digester.addRuleSet()</code> and pass the RuleSet
33   * instance.</li>
34   * <li>Digester will call the <code>addRuleInstances()</code> method of your RuleSet to configure the
35   * necessary rules.</li>
36   * </ul>
37   */
38  public interface RuleSet
39  {
40  
41      // ------------------------------------------------------------- Properties
42  
43      /**
44       * Return the namespace URI that will be applied to all Rule instances created from this RuleSet.
45       *
46       * @return the namespace URI that will be applied to all Rule instances created from this RuleSet
47       */
48      String getNamespaceURI();
49  
50      // --------------------------------------------------------- Public Methods
51  
52      /**
53       * Add the set of Rule instances defined in this RuleSet to the specified <code>Digester</code> instance,
54       * associating them with our namespace URI (if any). This method should only be called by a Digester instance.
55       * 
56       * @param digester Digester instance to which the new Rule instances should be added.
57       */
58      void addRuleInstances( Digester digester );
59  
60  }