01: /*
02: * Copyright (C) The MX4J Contributors.
03: * All rights reserved.
04: *
05: * This software is distributed under the terms of the MX4J License version 1.0.
06: * See the terms of the MX4J License in the documentation provided with this software.
07: */
08:
09: package javax.management;
10:
11: import java.io.Serializable;
12:
13: /**
14: * Base class for the MBean metadata classes.
15: *
16: * @version $Revision: 1.9 $
17: */
18: public class MBeanFeatureInfo implements Serializable {
19: private static final long serialVersionUID = 3952882688968447265L;
20:
21: /**
22: * @serial The name of the feature
23: */
24: protected String name;
25: /**
26: * @serial The description of the feature
27: */
28: protected String description;
29:
30: /**
31: * Creates a new MBean feature metadata object
32: *
33: * @param name The name of the feature
34: * @param description The description of the feature
35: */
36: public MBeanFeatureInfo(String name, String description) {
37: this .name = name;
38: this .description = description;
39: }
40:
41: /**
42: * Returns the name of the MBean feature
43: */
44: public String getName() {
45: return name;
46: }
47:
48: /**
49: * Returns the description of the MBean feature
50: */
51: public String getDescription() {
52: return description;
53: }
54:
55: public int hashCode() {
56: int hash = 0;
57: String n = getName();
58: if (n != null)
59: hash = 29 * hash + n.hashCode();
60: String d = getDescription();
61: if (d != null)
62: hash = 29 * hash + d.hashCode();
63: return hash;
64: }
65:
66: public boolean equals(Object obj) {
67: if (this == obj)
68: return true;
69: if (!(obj instanceof MBeanFeatureInfo))
70: return false;
71:
72: MBeanFeatureInfo other = (MBeanFeatureInfo) obj;
73: String this Name = getName();
74: String otherName = other.getName();
75: if (this Name != null ? !this Name.equals(otherName)
76: : otherName != null)
77: return false;
78: String this Descr = getDescription();
79: String otherDescr = other.getDescription();
80: if (this Descr != null ? !this Descr.equals(otherDescr)
81: : otherDescr != null)
82: return false;
83: return true;
84: }
85: }
|