View Javadoc

1   package org.apache.commons.digester3.plugins;
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  import org.apache.commons.digester3.Digester;
23  import org.apache.commons.digester3.Rules;
24  
25  /**
26   * Whenever the scope of a plugin tag is entered, the PluginRules class creates a new Rules instance and configures it
27   * with the appropriate parsing rules for the plugged-in class.
28   * <p>
29   * Users of the plugins module can specify a subclass of this one to control the creation of that Rules object. In
30   * particular, it can set up default rules within the returned instance which are applicable to all plugged-in classes.
31   * 
32   * @since 1.6
33   */
34  public abstract class RulesFactory
35  {
36  
37      /**
38       * Return an instance of some Rules implementation that the plugged-in class shall use to match its private parsing
39       * rules.
40       * <p>
41       * 
42       * @param d is the digester that the returned rules object will be associated with.
43       * @param pluginClass is the class that is to be configured using rules added to the returned object.
44       * @return an instance of some Rules implementation that the plugged-in class shall use to match its private parsing
45       *         rules.
46       * @throws PluginException if the algorithm finds a source of rules, but there is something invalid about that
47       *             source.
48       */
49      public abstract Rules newRules( Digester d, Class<?> pluginClass )
50          throws PluginException;
51  
52  }