KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > management > MBeanParameterInfo


1 /*
2  * @(#)MBeanParameterInfo.java 1.24 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package javax.management;
9
10
11 /**
12  * Describes an argument of an operation exposed by an MBean.
13  * Instances of this class are immutable. Subclasses may be mutable
14  * but this is not recommended.
15  *
16  * @since 1.5
17  */

18 public class MBeanParameterInfo extends MBeanFeatureInfo JavaDoc implements java.io.Serializable JavaDoc, Cloneable JavaDoc {
19
20     /* Serial version */
21     static final long serialVersionUID = 7432616882776782338L;
22
23     /* All zero-length arrays are interchangeable. */
24     static final MBeanParameterInfo JavaDoc[] NO_PARAMS = new MBeanParameterInfo JavaDoc[0];
25
26     /**
27      * @serial The type or class name of the data.
28      */

29     private final String JavaDoc type;
30      
31    
32     /**
33      * Constructs a <CODE>MBeanParameterInfo</CODE> object.
34      *
35      * @param name The name of the data
36      * @param type The type or class name of the data
37      * @param description A human readable description of the data. Optional.
38      */

39     public MBeanParameterInfo(String JavaDoc name,
40                   String JavaDoc type,
41                   String JavaDoc description)
42         throws IllegalArgumentException JavaDoc {
43     
44     super(name, description);
45
46     this.type = type;
47     }
48     
49
50     /**
51      * <p>Returns a shallow clone of this instance.
52      * The clone is obtained by simply calling <tt>super.clone()</tt>,
53      * thus calling the default native shallow cloning mechanism
54      * implemented by <tt>Object.clone()</tt>.
55      * No deeper cloning of any internal field is made.</p>
56      *
57      * <p>Since this class is immutable, cloning is chiefly of
58      * interest to subclasses.</p>
59      */

60      public Object JavaDoc clone () {
61      try {
62          return super.clone() ;
63      } catch (CloneNotSupportedException JavaDoc e) {
64          // should not happen as this class is cloneable
65
return null;
66      }
67      }
68
69     /**
70      * Returns the type or class name of the data.
71      *
72      * @return the type string.
73      */

74     public String JavaDoc getType() {
75     return type;
76     }
77
78     /**
79      * Compare this MBeanParameterInfo to another.
80      *
81      * @param o the object to compare to.
82      *
83      * @return true iff <code>o</code> is an MBeanParameterInfo such
84      * that its {@link #getName()}, {@link #getType()}, and {@link
85      * #getDescription()} values are equal (not necessarily identical)
86      * to those of this MBeanParameterInfo.
87      */

88     public boolean equals(Object JavaDoc o) {
89     if (o == this)
90         return true;
91     if (!(o instanceof MBeanParameterInfo JavaDoc))
92         return false;
93     MBeanParameterInfo JavaDoc p = (MBeanParameterInfo JavaDoc) o;
94     return (p.getName().equals(getName()) &&
95         p.getType().equals(getType()) &&
96         p.getDescription().equals(getDescription()));
97     }
98
99     public int hashCode() {
100     return getName().hashCode() ^ getType().hashCode();
101     }
102 }
103
Popular Tags