1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
/* * @(#)MBeanParameterInfo.java 1.29 06/03/15 * * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */ package javax.management; /** * Describes an argument of an operation exposed by an MBean. * Instances of this class are immutable. Subclasses may be mutable * but this is not recommended. * * @since 1.5 */ public class MBeanParameterInfo extends MBeanFeatureInfo implements Cloneable { /* Serial version */ static final long serialVersionUID = 7432616882776782338L; /* All zero-length arrays are interchangeable. */ static final MBeanParameterInfo[] NO_PARAMS = new MBeanParameterInfo[0]; /** * @serial The type or class name of the data. */ private final String type; /** * Constructs an <CODE>MBeanParameterInfo</CODE> object. * * @param name The name of the data * @param type The type or class name of the data * @param description A human readable description of the data. Optional. */ public MBeanParameterInfo(String name, String type, String description) { this(name, type, description, (Descriptor) null); } /** * Constructs an <CODE>MBeanParameterInfo</CODE> object. * * @param name The name of the data * @param type The type or class name of the data * @param description A human readable description of the data. Optional. * @param descriptor The descriptor for the operation. This may be null * which is equivalent to an empty descriptor. * * @since 1.6 */ public MBeanParameterInfo(String name, String type, String description, Descriptor descriptor) { super(name, description, descriptor); this.type = type; } /** * <p>Returns a shallow clone of this instance. * The clone is obtained by simply calling <tt>super.clone()</tt>, * thus calling the default native shallow cloning mechanism * implemented by <tt>Object.clone()</tt>. * No deeper cloning of any internal field is made.</p> * * <p>Since this class is immutable, cloning is chiefly of * interest to subclasses.</p> */ public Object clone () { try { return super.clone() ; } catch (CloneNotSupportedException e) { // should not happen as this class is cloneable return null; } } /** * Returns the type or class name of the data. * * @return the type string. */ public String getType() { return type; } public String toString() { return getClass().getName() + "[" + "description=" + getDescription() + ", " + "name=" + getName() + ", " + "type=" + getType() + ", " + "descriptor=" + getDescriptor() + "]"; } /** * Compare this MBeanParameterInfo to another. * * @param o the object to compare to. * * @return true if and only if <code>o</code> is an MBeanParameterInfo such * that its {@link #getName()}, {@link #getType()}, * {@link #getDescriptor()}, and {@link * #getDescription()} values are equal (not necessarily identical) * to those of this MBeanParameterInfo. */ public boolean equals(Object o) { if (o == this) return true; if (!(o instanceof MBeanParameterInfo)) return false; MBeanParameterInfo p = (MBeanParameterInfo) o; return (p.getName().equals(getName()) && p.getType().equals(getType()) && p.getDescription().equals(getDescription()) && p.getDescriptor().equals(getDescriptor())); } public int hashCode() { return getName().hashCode() ^ getType().hashCode(); } }