KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > config > ConfigElement


1 /*
2  * Copyright (C) 2005 Alfresco, Inc.
3  *
4  * Licensed under the Mozilla Public License version 1.1
5  * with a permitted attribution clause. You may obtain a
6  * copy of the License at
7  *
8  * http://www.alfresco.org/legal/license.txt
9  *
10  * Unless required by applicable law or agreed to in writing,
11  * software distributed under the License is distributed on an
12  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13  * either express or implied. See the License for the specific
14  * language governing permissions and limitations under the
15  * License.
16  */

17 package org.alfresco.config;
18
19 import java.util.List JavaDoc;
20 import java.util.Map JavaDoc;
21
22 /**
23  * Definition of a configuration element
24  *
25  * @author gavinc
26  */

27 public interface ConfigElement
28 {
29     /**
30      * Returns the name of this config element
31      *
32      * @return Name of this config element
33      */

34     public String JavaDoc getName();
35
36     /**
37      * Gets the value of the attrbiute with the given name
38      *
39      * @param name
40      * The name of the attrbiute to get the value for
41      * @return The value of the attrbiute or null if the attribute doesn't exist
42      */

43     public String JavaDoc getAttribute(String JavaDoc name);
44
45     /**
46      * Returns the list of attributes held by this config element
47      *
48      * @return The list of attrbiutes
49      */

50     public Map JavaDoc<String JavaDoc, String JavaDoc> getAttributes();
51
52     /**
53      * Determines whether the config element has the named attribute
54      *
55      * @param name
56      * Name of the attribute to check existence for
57      * @return true if it exists, false otherwise
58      */

59     public boolean hasAttribute(String JavaDoc name);
60
61     /**
62      * Returns the number of attributes this config element has
63      *
64      * @return The number of attributes
65      */

66     public int getAttributeCount();
67     
68     /**
69      * Gets the value of this config element. If this config element has
70      * children then this method may return null
71      *
72      * @return Value of this config element or null if there is no value
73      */

74     public String JavaDoc getValue();
75
76     /**
77      * Returns a child config element of the given name
78      *
79      * @param name The name of the config element to retrieve
80      * @return The ConfigElement or null if it does not exist
81      */

82     public ConfigElement getChild(String JavaDoc name);
83     
84     /**
85      * Returns a list of children held by this ConfigElement
86      *
87      * @return The list of children.
88      */

89     public List JavaDoc<ConfigElement> getChildren();
90
91     /**
92      * Determines whether this config element has any children. It is more
93      * effecient to call this method rather than getChildren().size() as a
94      * collection is not created if it is not required
95      *
96      * @return true if it has children, false otherwise
97      */

98     public boolean hasChildren();
99
100     /**
101      * Returns the number of children this config element has
102      *
103      * @return The number of children
104      */

105     public int getChildCount();
106     
107     /**
108      * Combines the given config element with this config element and returns a
109      * new instance containing the resulting combination. The combination of the
110      * two objects MUST NOT change this instance.
111      *
112      * @param configElement
113      * The config element to combine into this one
114      * @return The combined ConfigElement
115      */

116     public ConfigElement combine(ConfigElement configElement);
117 }
118
Popular Tags