KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > digester > Rules


1 /* $Id: Rules.java 155412 2005-02-26 12:58:36Z dirkv $
2  *
3  * Copyright 2001-2004 The Apache Software Foundation.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

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

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

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

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

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

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

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

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

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

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

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

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

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