KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sapia > soto > jmx > ParameterDescriptor


1 package org.sapia.soto.jmx;
2
3 import org.sapia.soto.util.Type;
4
5 import javax.management.MBeanParameterInfo JavaDoc;
6
7
8 /**
9  * An instance of this class encapsulates the information necessary
10  * to create a corresponding <code>MBeanParameterInfo</code> object.
11  * Callers can set a description.
12  *
13  * @author Yanick Duchesne
14  * <dl>
15  * <dt><b>Copyright:</b><dd>Copyright &#169; 2002-2003 <a HREF="http://www.sapia-oss.org">Sapia Open Source Software</a>. All Rights Reserved.</dd></dt>
16  * <dt><b>License:</b><dd>Read the license.txt file of the jar or visit the
17  * <a HREF="http://www.sapia-oss.org/license.html">license page</a> at the Sapia OSS web site</dd></dt>
18  * </dl>
19  */

20 public class ParameterDescriptor {
21   private String JavaDoc _name;
22   private String JavaDoc _type;
23   private String JavaDoc _desc = MBeanDescriptor.DEFAULT_DESC;
24
25   /**
26    * Constructor for ParameterDescriptor.
27    */

28   public ParameterDescriptor() {
29     super();
30   }
31
32   /**
33    * Sets this instance's description.
34    *
35    * @param desc a description.
36    */

37   public void setDescription(String JavaDoc desc) {
38     _desc = desc;
39   }
40
41   /**
42    * Sets the name of this parameter - used for display purposes by JMX
43    * consoles.
44    *
45    * @param name the name of the MBean parameter to which this instance
46    * corresponds.
47    */

48   public void setName(String JavaDoc name) {
49     _name = name;
50   }
51
52   /**
53    * Returns the <code>MBeanParameter</code> that corresponds to this
54    * instance's parameter - in a MBean operation.
55    *
56    * @return a <code>MBeanParameterInfo</code>.
57    * @see OperationDescriptor
58    */

59   public MBeanParameterInfo JavaDoc getInfo() {
60     return new MBeanParameterInfo JavaDoc(_name,
61       Type.hasTypeForName(_type) ? Type.getTypeForName(_type).getClassName()
62                                  : _type, _desc);
63   }
64
65   /**
66    * Sets the "type" of this instance - corresponds to the full-qualified name
67    * of a Java type that is part of a method signature.
68    *
69    * @param type the name of Java type.
70    */

71   void setType(String JavaDoc type) {
72     _type = type;
73   }
74
75   public String JavaDoc toString() {
76     return "[ name=" + _name + ", type=" + _type + ", description=" + _desc +
77     " ]";
78   }
79 }
80
Popular Tags