KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > management > MBeanFeatureInfo


1 /*
2  * @(#)MBeanFeatureInfo.java 1.22 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  * <p>Provides general information for an MBean descriptor object.
13  * The feature described can be an attribute, an operation, a
14  * parameter, or a notification. Instances of this class are
15  * immutable. Subclasses may be mutable but this is not
16  * recommended.</p>
17  *
18  * @since 1.5
19  */

20 public class MBeanFeatureInfo implements java.io.Serializable JavaDoc {
21      
22
23     /* Serial version */
24     static final long serialVersionUID = 3952882688968447265L;
25
26     /**
27      * The name of the feature. It is recommended that subclasses call
28      * {@link #getName} rather than reading this field, and that they
29      * not change it.
30      *
31      * @serial The name of the feature.
32      */

33     protected String JavaDoc name;
34     
35     /**
36      * The human-readable description of the feature. It is
37      * recommended that subclasses call {@link #getDescription} rather
38      * than reading this field, and that they not change it.
39      *
40      * @serial The human-readable description of the feature.
41      */

42     protected String JavaDoc description;
43     
44     
45     /**
46      * Constructs an <CODE>MBeanFeatureInfo</CODE> object.
47      *
48      * @param name The name of the feature.
49      * @param description A human readable description of the feature.
50      */

51     public MBeanFeatureInfo(String JavaDoc name, String JavaDoc description)
52         throws IllegalArgumentException JavaDoc {
53     this.name = name;
54     this.description = description;
55     }
56
57
58     /**
59      * Returns the name of the feature.
60      *
61      * @return the name of the feature.
62      */

63     public String JavaDoc getName() {
64     return name;
65     }
66     
67     /**
68      * Returns the human-readable description of the feature.
69      *
70      * @return the human-readable description of the feature.
71      */

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

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