KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sapia > validator > Namespace


1 package org.sapia.validator;
2
3 import java.util.ArrayList JavaDoc;
4 import java.util.List JavaDoc;
5
6 import org.sapia.validator.config.Def;
7
8 /**
9  * An instance of this class holds rule definitions.
10  *
11  * @see org.sapia.validator.config.Def
12  *
13  * @author Yanick Duchesne
14  * <dl>
15  * <dt><b>Copyright:</b><dd>Copyright &#169; 2002-2003 <a HREF="http://www.sapia-oss.org">Sapia Open Source Software</a>. All Rights Reserved.</dd></dt>
16  * <dt><b>License:</b><dd>Read the license.txt file of the jar or visit the
17  * <a HREF="http://www.sapia-oss.org/license.html">license page</a> at the Sapia OSS web site</dd></dt>
18  * </dl>
19  */

20 public class Namespace {
21   private String JavaDoc _prefix;
22   private List JavaDoc _defs = new ArrayList JavaDoc();
23
24   /**
25    * Constructor for Namespace.
26    */

27   public Namespace() {
28   }
29
30   /**
31    * Returns this namespace's prefix.
32    *
33    * @return a prefix, as a string.
34    */

35   public String JavaDoc getPrefix() {
36     return _prefix;
37   }
38
39   /**
40    * Sets this instance's prefix.
41    *
42    * @param prefix a prefix.
43    */

44   public void setPrefix(String JavaDoc prefix) {
45     _prefix = prefix;
46   }
47
48   /**
49    * Internally creates a rule definition instance, adds it
50    * to this instance, and returns it to the caller.
51    *
52    * @return a <code>Def</code> instance.
53    */

54   public Def createRuleDef() {
55     Def d = new Def();
56
57     _defs.add(d);
58
59     return d;
60   }
61   
62   /**
63    * Return this instance's list of rule definitions.
64    *
65    * @return a <code>List</code> of <code>Def</code> instances.
66    */

67   public List JavaDoc getRuleDefs() {
68     return _defs;
69   }
70 }
71
Popular Tags