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