01: // The contents of this file are subject to the Mozilla Public License Version
02: // 1.1
03: //(the "License"); you may not use this file except in compliance with the
04: //License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
05: //
06: //Software distributed under the License is distributed on an "AS IS" basis,
07: //WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
08: //for the specific language governing rights and
09: //limitations under the License.
10: //
11: //The Original Code is "The Columba Project"
12: //
13: //The Initial Developers of the Original Code are Frederik Dietz and Timo
14: // Stich.
15: //Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
16: //
17: //All Rights Reserved.
18: package org.columa.core.config;
19:
20: import org.columba.core.xml.XmlElement;
21:
22: /**
23: * @author fdietz
24: *
25: */
26: public interface IDefaultItem {
27:
28: XmlElement getRoot();
29:
30: /** ********************** composition pattern ********************* */
31:
32: XmlElement getElement(String pathToElement);
33:
34: XmlElement getChildElement(int index);
35:
36: int getChildCount();
37:
38: XmlElement getChildElement(String pathToElement, int index);
39:
40: boolean contains(String key);
41:
42: String get(String key);
43:
44: String getString(String pathToElement, String key);
45:
46: String getStringWithDefault(String pathToElement, String key,
47: String defaultValue);
48:
49: void setString(String key, String newValue);
50:
51: void setString(String pathToElement, String key, String newValue);
52:
53: /** ************************** helper classes ************************** */
54:
55: int getInteger(String key);
56:
57: int getIntegerWithDefault(String key, int defaultValue);
58:
59: int getInteger(String pathToElement, String key);
60:
61: int getIntegerWithDefault(String pathToElement, String key,
62: int defaultValue);
63:
64: void setInteger(String key, int value);
65:
66: void setInteger(String pathToElement, String key, int value);
67:
68: boolean getBooleanWithDefault(String key, boolean defaultValue);
69:
70: boolean getBoolean(String key);
71:
72: boolean getBoolean(String pathToElement, String key);
73:
74: boolean getBooleanWithDefault(String pathToElement, String key,
75: boolean defaultValue);
76:
77: void setBoolean(String key, boolean value);
78:
79: void setBoolean(String pathToElement, String key, boolean value);
80:
81: boolean equals(Object obj);
82:
83: /** {@inheritDoc} */
84: int hashCode();
85:
86: /** {@inheritDoc} */
87: Object clone();
88:
89: /**
90: * @param string
91: * @param string2
92: * @return
93: */
94: String getStringWithDefault(String key, String defaultValue);
95: }
|