1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.commons.modeler;
19
20
21 import java.io.Serializable;
22 import java.util.ArrayList;
23 import java.util.Iterator;
24 import java.util.List;
25
26 import javax.management.Descriptor;
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: 155428 $ $Date: 2005-02-26 08:12:25 -0500 (Sat, 26 Feb 2005) $
37 */
38
39 public class FeatureInfo implements Serializable {
40 static final long serialVersionUID = -911529176124712296L;
41 protected String description = null;
42 protected List fields = new ArrayList();
43 protected String name = null;
44
45
46
47
48 /***
49 * The human-readable description of this feature.
50 */
51 public String getDescription() {
52 return (this.description);
53 }
54
55 public void setDescription(String description) {
56 this.description = description;
57 }
58
59
60 /***
61 * The field information for this feature.
62 */
63 public List 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 getName() {
73 return (this.name);
74 }
75
76 public void setName(String name) {
77 this.name = name;
78 }
79
80
81
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
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 descriptor) {
105
106 Iterator 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 }