KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jcckit > util > ConfigData


1 /*
2  * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
3  *
4  * This library is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as published by
6  * the Free Software Foundation; either version 2.1 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser General Public License for more details
13  * (http://www.gnu.org/copyleft/lesser.html).
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */

19 package jcckit.util;
20
21 /**
22  * Interface for hierarchically managed key-value pairs. The key is
23  * always a string which contains any kind of printable character except
24  * '/', '=', ':', and whitespace characters like ' ' and '\t'.
25  * The value is either a string or a <tt>ConfigData</tt> object.
26  * <p>
27  * This interface will be used by {@link ConfigParameters} in accordance
28  * with the Strategy design pattern.
29  *
30  * @author Franz-Josef Elmer
31  */

32 public interface ConfigData {
33   /**
34    * Returns the full key.
35    * @param key A (relative) key. <tt>null</tt> is not allowed.
36    * @return the full key including path.
37    */

38   public String JavaDoc getFullKey(String JavaDoc key);
39
40   /**
41    * Returns the value associated with this key.
42    * @param key The relative key. <tt>null</tt> is not allowed.
43    * @return the associated value. Will be <tt>null</tt> if no value exists
44    * for <tt>key</tt>.
45    */

46   public String JavaDoc get(String JavaDoc key);
47
48   /**
49    * Returns the <tt>ConfigData</tt> object associated with this key.
50    * @param key The relative key. <tt>null</tt> is not allowed.
51    * @return the associated value. Will never return <tt>null</tt>.
52    * Instead an empty <tt>ConfigData</tt> is returned.
53    */

54   public ConfigData getNode(String JavaDoc key);
55 }
56
Popular Tags