KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > modeler > FeatureInfo


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

16
17
18 package org.apache.commons.modeler;
19
20
21 import java.io.Serializable JavaDoc;
22 import java.util.ArrayList JavaDoc;
23 import java.util.Iterator JavaDoc;
24 import java.util.List JavaDoc;
25
26 import javax.management.Descriptor JavaDoc;
27
28
29 /**
30  * <p>Convenience base class for <code>AttributeInfo</code>,
31  * <code>ConstructorInfo</code>, and <code>OperationInfo</code> classes
32  * that will be used to collect configuration information for the
33  * <code>ModelMBean</code> beans exposed for management.</p>
34  *
35  * @author Craig R. McClanahan
36  * @version $Revision$ $Date: 2005-02-26 05:12:25 -0800 (Sat, 26 Feb 2005) $
37  */

38
39 public class FeatureInfo implements Serializable JavaDoc {
40     static final long serialVersionUID = -911529176124712296L;
41     protected String JavaDoc description = null;
42     protected List JavaDoc fields = new ArrayList JavaDoc();
43     protected String JavaDoc name = null;
44
45     // ------------------------------------------------------------- Properties
46

47
48     /**
49      * The human-readable description of this feature.
50      */

51     public String JavaDoc getDescription() {
52         return (this.description);
53     }
54
55     public void setDescription(String JavaDoc description) {
56         this.description = description;
57     }
58
59
60     /**
61      * The field information for this feature.
62      */

63     public List JavaDoc getFields() {
64         return (fields);
65     }
66
67
68     /**
69      * The name of this feature, which must be unique among features in the
70      * same collection.
71      */

72     public String JavaDoc getName() {
73         return (this.name);
74     }
75
76     public void setName(String JavaDoc name) {
77         this.name = name;
78     }
79
80
81     // --------------------------------------------------------- Public Methods
82

83
84     /**
85      * <p>Add a new field to the fields associated with the
86      * Descriptor that will be created from this metadata.</p>
87      *
88      * @param field The field to be added
89      */

90     public void addField(FieldInfo field) {
91         fields.add(field);
92     }
93
94
95     // ------------------------------------------------------ Protected Methods
96

97
98     /**
99      * <p>Add the name/value fields that have been stored into the
100      * specified <code>Descriptor</code> instance.</p>
101      *
102      * @param descriptor The <code>Descriptor</code> to add fields to
103      */

104     protected void addFields(Descriptor JavaDoc descriptor) {
105
106         Iterator JavaDoc items = getFields().iterator();
107         while (items.hasNext()) {
108             FieldInfo item = (FieldInfo) items.next();
109             descriptor.setField(item.getName(), item.getValue());
110         }
111
112     }
113
114
115 }
116
Popular Tags