1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.commons.modeler;
20
21
22 import java.io.Serializable;
23 import java.util.ArrayList;
24 import java.util.Iterator;
25 import java.util.List;
26
27 import javax.management.Descriptor;
28
29
30 /***
31 * <p>Convenience base class for <code>AttributeInfo</code>,
32 * <code>ConstructorInfo</code>, and <code>OperationInfo</code> classes
33 * that will be used to collect configuration information for the
34 * <code>ModelMBean</code> beans exposed for management.</p>
35 *
36 * @author Craig R. McClanahan
37 * @version $Revision: 480402 $ $Date: 2006-11-29 04:43:23 +0000 (Wed, 29 Nov 2006) $
38 */
39
40 public class FeatureInfo implements Serializable {
41 static final long serialVersionUID = -911529176124712296L;
42 protected String description = null;
43 protected List fields = new ArrayList();
44 protected String name = null;
45
46
47
48
49 /***
50 * The human-readable description of this feature.
51 */
52 public String getDescription() {
53 return (this.description);
54 }
55
56 public void setDescription(String description) {
57 this.description = description;
58 }
59
60
61 /***
62 * The field information for this feature.
63 */
64 public List getFields() {
65 return (fields);
66 }
67
68
69 /***
70 * The name of this feature, which must be unique among features in the
71 * same collection.
72 */
73 public String getName() {
74 return (this.name);
75 }
76
77 public void setName(String name) {
78 this.name = name;
79 }
80
81
82
83
84
85 /***
86 * <p>Add a new field to the fields associated with the
87 * Descriptor that will be created from this metadata.</p>
88 *
89 * @param field The field to be added
90 */
91 public void addField(FieldInfo field) {
92 fields.add(field);
93 }
94
95
96
97
98
99 /***
100 * <p>Add the name/value fields that have been stored into the
101 * specified <code>Descriptor</code> instance.</p>
102 *
103 * @param descriptor The <code>Descriptor</code> to add fields to
104 */
105 protected void addFields(Descriptor descriptor) {
106
107 Iterator items = getFields().iterator();
108 while (items.hasNext()) {
109 FieldInfo item = (FieldInfo) items.next();
110 descriptor.setField(item.getName(), item.getValue());
111 }
112
113 }
114
115
116 }