53 * @serial The signature of the method, that is, the class names of the arguments. |
53 * @serial The signature of the method, that is, the class names of the arguments. |
54 */ |
54 */ |
55 private final MBeanParameterInfo[] signature; |
55 private final MBeanParameterInfo[] signature; |
56 |
56 |
57 /** |
57 /** |
58 * Constructs an <CODE>MBeanConstructorInfo</CODE> object. The |
58 * Constructs an {@code MBeanConstructorInfo} object. The |
59 * {@link Descriptor} of the constructed object will include |
59 * {@link Descriptor} of the constructed object will include |
60 * fields contributed by any annotations on the {@code |
60 * fields contributed by any annotations on the {@code |
61 * Constructor} object that contain the {@link DescriptorKey} |
61 * Constructor} object that contain the {@link DescriptorKey} |
62 * meta-annotation. |
62 * meta-annotation. |
63 * |
63 * |
64 * @param description A human readable description of the operation. |
64 * @param description A human readable description of the operation. |
65 * @param constructor The <CODE>java.lang.reflect.Constructor</CODE> |
65 * @param constructor The {@code java.lang.reflect.Constructor} |
66 * object describing the MBean constructor. |
66 * object describing the MBean constructor. |
67 */ |
67 */ |
68 public MBeanConstructorInfo(String description, Constructor<?> constructor) { |
68 public MBeanConstructorInfo(String description, Constructor<?> constructor) { |
69 this(constructor.getName(), description, |
69 this(constructor.getName(), description, |
70 constructorSignature(constructor), |
70 constructorSignature(constructor), |
71 Introspector.descriptorForElement(constructor)); |
71 Introspector.descriptorForElement(constructor)); |
72 } |
72 } |
73 |
73 |
74 /** |
74 /** |
75 * Constructs an <CODE>MBeanConstructorInfo</CODE> object. |
75 * Constructs an {@code MBeanConstructorInfo} object. |
76 * |
76 * |
77 * @param name The name of the constructor. |
77 * @param name The name of the constructor. |
78 * @param signature <CODE>MBeanParameterInfo</CODE> objects |
78 * @param signature {@code MBeanParameterInfo} objects |
79 * describing the parameters(arguments) of the constructor. This |
79 * describing the parameters(arguments) of the constructor. This |
80 * may be null with the same effect as a zero-length array. |
80 * may be null with the same effect as a zero-length array. |
81 * @param description A human readable description of the constructor. |
81 * @param description A human readable description of the constructor. |
82 */ |
82 */ |
83 public MBeanConstructorInfo(String name, |
83 public MBeanConstructorInfo(String name, |
85 MBeanParameterInfo[] signature) { |
85 MBeanParameterInfo[] signature) { |
86 this(name, description, signature, null); |
86 this(name, description, signature, null); |
87 } |
87 } |
88 |
88 |
89 /** |
89 /** |
90 * Constructs an <CODE>MBeanConstructorInfo</CODE> object. |
90 * Constructs an {@code MBeanConstructorInfo} object. |
91 * |
91 * |
92 * @param name The name of the constructor. |
92 * @param name The name of the constructor. |
93 * @param signature <CODE>MBeanParameterInfo</CODE> objects |
93 * @param signature {@code MBeanParameterInfo} objects |
94 * describing the parameters(arguments) of the constructor. This |
94 * describing the parameters(arguments) of the constructor. This |
95 * may be null with the same effect as a zero-length array. |
95 * may be null with the same effect as a zero-length array. |
96 * @param description A human readable description of the constructor. |
96 * @param description A human readable description of the constructor. |
97 * @param descriptor The descriptor for the constructor. This may be null |
97 * @param descriptor The descriptor for the constructor. This may be null |
98 * which is equivalent to an empty descriptor. |
98 * which is equivalent to an empty descriptor. |
116 } |
116 } |
117 |
117 |
118 |
118 |
119 /** |
119 /** |
120 * <p>Returns a shallow clone of this instance. The clone is |
120 * <p>Returns a shallow clone of this instance. The clone is |
121 * obtained by simply calling <tt>super.clone()</tt>, thus calling |
121 * obtained by simply calling {@code super.clone()}, thus calling |
122 * the default native shallow cloning mechanism implemented by |
122 * the default native shallow cloning mechanism implemented by |
123 * <tt>Object.clone()</tt>. No deeper cloning of any internal |
123 * {@code Object.clone()}. No deeper cloning of any internal |
124 * field is made.</p> |
124 * field is made.</p> |
125 * |
125 * |
126 * <p>Since this class is immutable, cloning is chiefly of |
126 * <p>Since this class is immutable, cloning is chiefly of |
127 * interest to subclasses.</p> |
127 * interest to subclasses.</p> |
128 */ |
128 */ |
135 } |
135 } |
136 } |
136 } |
137 |
137 |
138 /** |
138 /** |
139 * <p>Returns the list of parameters for this constructor. Each |
139 * <p>Returns the list of parameters for this constructor. Each |
140 * parameter is described by an <CODE>MBeanParameterInfo</CODE> |
140 * parameter is described by an {@code MBeanParameterInfo} |
141 * object.</p> |
141 * object.</p> |
142 * |
142 * |
143 * <p>The returned array is a shallow copy of the internal array, |
143 * <p>The returned array is a shallow copy of the internal array, |
144 * which means that it is a copy of the internal array of |
144 * which means that it is a copy of the internal array of |
145 * references to the <CODE>MBeanParameterInfo</CODE> objects but |
145 * references to the {@code MBeanParameterInfo} objects but |
146 * that each referenced <CODE>MBeanParameterInfo</CODE> object is |
146 * that each referenced {@code MBeanParameterInfo} object is |
147 * not copied.</p> |
147 * not copied.</p> |
148 * |
148 * |
149 * @return An array of <CODE>MBeanParameterInfo</CODE> objects. |
149 * @return An array of {@code MBeanParameterInfo} objects. |
150 */ |
150 */ |
151 public MBeanParameterInfo[] getSignature() { |
151 public MBeanParameterInfo[] getSignature() { |
152 if (signature.length == 0) |
152 if (signature.length == 0) |
153 return signature; |
153 return signature; |
154 else |
154 else |
175 /** |
175 /** |
176 * Compare this MBeanConstructorInfo to another. |
176 * Compare this MBeanConstructorInfo to another. |
177 * |
177 * |
178 * @param o the object to compare to. |
178 * @param o the object to compare to. |
179 * |
179 * |
180 * @return true if and only if <code>o</code> is an MBeanConstructorInfo such |
180 * @return true if and only if {@code o} is an MBeanConstructorInfo such |
181 * that its {@link #getName()}, {@link #getDescription()}, |
181 * that its {@link #getName()}, {@link #getDescription()}, |
182 * {@link #getSignature()}, and {@link #getDescriptor()} |
182 * {@link #getSignature()}, and {@link #getDescriptor()} |
183 * values are equal (not necessarily |
183 * values are equal (not necessarily |
184 * identical) to those of this MBeanConstructorInfo. Two |
184 * identical) to those of this MBeanConstructorInfo. Two |
185 * signature arrays are equal if their elements are pairwise |
185 * signature arrays are equal if their elements are pairwise |