KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tomcat > util > digester > Rules


1 /* $Id: Rules.java 467222 2006-10-24 03:17:11Z markt $
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one or more
4  * contributor license agreements. See the NOTICE file distributed with
5  * this work for additional information regarding copyright ownership.
6  * The ASF licenses this file to You under the Apache License, Version 2.0
7  * (the "License"); you may not use this file except in compliance with
8  * the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */

18
19
20 package org.apache.tomcat.util.digester;
21
22
23 import java.util.List JavaDoc;
24
25
26 /**
27  * Public interface defining a collection of Rule instances (and corresponding
28  * matching patterns) plus an implementation of a matching policy that selects
29  * the rules that match a particular pattern of nested elements discovered
30  * during parsing.
31  */

32
33 public interface Rules {
34
35
36     // ------------------------------------------------------------- Properties
37

38
39     /**
40      * Return the Digester instance with which this Rules instance is
41      * associated.
42      */

43     public Digester getDigester();
44
45
46     /**
47      * Set the Digester instance with which this Rules instance is associated.
48      *
49      * @param digester The newly associated Digester instance
50      */

51     public void setDigester(Digester digester);
52
53
54     /**
55      * Return the namespace URI that will be applied to all subsequently
56      * added <code>Rule</code> objects.
57      */

58     public String JavaDoc getNamespaceURI();
59
60
61     /**
62      * Set the namespace URI that will be applied to all subsequently
63      * added <code>Rule</code> objects.
64      *
65      * @param namespaceURI Namespace URI that must match on all
66      * subsequently added rules, or <code>null</code> for matching
67      * regardless of the current namespace URI
68      */

69     public void setNamespaceURI(String JavaDoc namespaceURI);
70
71
72     // --------------------------------------------------------- Public Methods
73

74
75     /**
76      * Register a new Rule instance matching the specified pattern.
77      *
78      * @param pattern Nesting pattern to be matched for this Rule
79      * @param rule Rule instance to be registered
80      */

81     public void add(String JavaDoc pattern, Rule rule);
82
83
84     /**
85      * Clear all existing Rule instance registrations.
86      */

87     public void clear();
88
89
90     /**
91      * Return a List of all registered Rule instances that match the specified
92      * nesting pattern, or a zero-length List if there are no matches. If more
93      * than one Rule instance matches, they <strong>must</strong> be returned
94      * in the order originally registered through the <code>add()</code>
95      * method.
96      *
97      * @param pattern Nesting pattern to be matched
98      *
99      * @deprecated Call match(namespaceURI,pattern) instead.
100      */

101     public List JavaDoc match(String JavaDoc pattern);
102
103
104     /**
105      * Return a List of all registered Rule instances that match the specified
106      * nesting pattern, or a zero-length List if there are no matches. If more
107      * than one Rule instance matches, they <strong>must</strong> be returned
108      * in the order originally registered through the <code>add()</code>
109      * method.
110      *
111      * @param namespaceURI Namespace URI for which to select matching rules,
112      * or <code>null</code> to match regardless of namespace URI
113      * @param pattern Nesting pattern to be matched
114      */

115     public List JavaDoc match(String JavaDoc namespaceURI, String JavaDoc pattern);
116
117
118     /**
119      * Return a List of all registered Rule instances, or a zero-length List
120      * if there are no registered Rule instances. If more than one Rule
121      * instance has been registered, they <strong>must</strong> be returned
122      * in the order originally registered through the <code>add()</code>
123      * method.
124      */

125     public List JavaDoc rules();
126
127
128 }
129
Popular Tags