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
23 import javax.management.MBeanParameterInfo;
24
25
26 /***
27 * <p>Internal configuration information for a <code>Parameter</code>
28 * descriptor.</p>
29 *
30 * @author Craig R. McClanahan
31 * @version $Revision: 155428 $ $Date: 2005-02-26 08:12:25 -0500 (Sat, 26 Feb 2005) $
32 */
33
34 public class ParameterInfo extends FeatureInfo implements Serializable {
35 static final long serialVersionUID = 2222796006787664020L;
36
37
38
39 /***
40 * Standard zero-arguments constructor.
41 */
42 public ParameterInfo() {
43
44 super();
45
46 }
47
48
49 /***
50 * Special constructor for setting up parameters programatically.
51 *
52 * @param name Name of this parameter
53 * @param type Java class of this parameter
54 * @param description Description of this parameter
55 */
56 public ParameterInfo(String name, String type, String description) {
57
58 super();
59 setName(name);
60 setType(type);
61 setDescription(description);
62
63 }
64
65
66
67
68
69 /***
70 * The <code>MBeanParameterInfo</code> object that corresponds
71 * to this <code>ParameterInfo</code> instance.
72 */
73 transient MBeanParameterInfo info = null;
74 protected String type = null;
75
76
77
78
79 /***
80 * Override the <code>description</code> property setter.
81 *
82 * @param description The new description
83 */
84 public void setDescription(String description) {
85 super.setDescription(description);
86 this.info = null;
87 }
88
89
90 /***
91 * Override the <code>name</code> property setter.
92 *
93 * @param name The new name
94 */
95 public void setName(String name) {
96 super.setName(name);
97 this.info = null;
98 }
99
100
101 /***
102 * The fully qualified Java class name of this parameter.
103 */
104 public String getType() {
105 return (this.type);
106 }
107
108 public void setType(String type) {
109 this.type = type;
110 this.info = null;
111 }
112
113
114
115
116
117 /***
118 * Create and return a <code>MBeanParameterInfo</code> object that
119 * corresponds to the parameter described by this instance.
120 */
121 public MBeanParameterInfo createParameterInfo() {
122
123
124 if (info != null)
125 return (info);
126
127
128 info = new MBeanParameterInfo
129 (getName(), getType(), getDescription());
130 return (info);
131
132 }
133
134
135 /***
136 * Return a string representation of this parameter descriptor.
137 */
138 public String toString() {
139
140 StringBuffer sb = new StringBuffer("ParameterInfo[");
141 sb.append("name=");
142 sb.append(name);
143 sb.append(", description=");
144 sb.append(description);
145 sb.append(", type=");
146 sb.append(type);
147 sb.append("]");
148 return (sb.toString());
149
150 }
151 }