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: import mx4j.util.Utils;
14:
15: /**
16: * Metadata class for MBean notifications.
17: *
18: * @version $Revision: 1.13 $
19: */
20: // Change not needed, workaround to a TCK bug only to achieve TCK compliance
21: // public class MBeanNotificationInfo extends MBeanFeatureInfo implements Cloneable
22: public class MBeanNotificationInfo extends MBeanFeatureInfo implements
23: Cloneable, Serializable {
24: private static final long serialVersionUID = -3888371564530107064L;
25:
26: /**
27: * @serial The notification types
28: */
29: private String[] types;
30:
31: /**
32: * Creates a new MBeanNotificationInfo
33: *
34: * @param notifsType The types
35: * @param name The classname of the Notifications emitted
36: * @param description The description for these notifications
37: */
38: public MBeanNotificationInfo(String[] notifsType, String name,
39: String description) {
40: super (name, description);
41: this .types = notifsType == null ? new String[0] : notifsType;
42: }
43:
44: public Object clone() {
45: try {
46: return super .clone();
47: } catch (CloneNotSupportedException ignored) {
48: return null;
49: }
50: }
51:
52: /**
53: * Returns the types of the notifications emitted.
54: */
55: public String[] getNotifTypes() {
56: return types;
57: }
58:
59: public int hashCode() {
60: return super .hashCode() + 29
61: * Utils.arrayHashCode(getNotifTypes());
62: }
63:
64: public boolean equals(Object obj) {
65: if (!super .equals(obj))
66: return false;
67: if (!(obj instanceof MBeanNotificationInfo))
68: return false;
69:
70: MBeanNotificationInfo other = (MBeanNotificationInfo) obj;
71: return Utils
72: .arrayEquals(getNotifTypes(), other.getNotifTypes());
73: }
74: }
|