0N/A/*
2362N/A * Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage javax.management;
0N/A
0N/A
0N/A/**
0N/A * Describes an argument of an operation exposed by an MBean.
0N/A * Instances of this class are immutable. Subclasses may be mutable
0N/A * but this is not recommended.
0N/A *
0N/A * @since 1.5
0N/A */
0N/Apublic class MBeanParameterInfo extends MBeanFeatureInfo implements Cloneable {
0N/A
0N/A /* Serial version */
0N/A static final long serialVersionUID = 7432616882776782338L;
0N/A
0N/A /* All zero-length arrays are interchangeable. */
0N/A static final MBeanParameterInfo[] NO_PARAMS = new MBeanParameterInfo[0];
0N/A
0N/A /**
0N/A * @serial The type or class name of the data.
0N/A */
0N/A private final String type;
0N/A
0N/A
0N/A /**
0N/A * Constructs an <CODE>MBeanParameterInfo</CODE> object.
0N/A *
0N/A * @param name The name of the data
0N/A * @param type The type or class name of the data
0N/A * @param description A human readable description of the data. Optional.
0N/A */
0N/A public MBeanParameterInfo(String name,
0N/A String type,
0N/A String description) {
0N/A this(name, type, description, (Descriptor) null);
0N/A }
0N/A
0N/A /**
0N/A * Constructs an <CODE>MBeanParameterInfo</CODE> object.
0N/A *
0N/A * @param name The name of the data
0N/A * @param type The type or class name of the data
0N/A * @param description A human readable description of the data. Optional.
0N/A * @param descriptor The descriptor for the operation. This may be null
0N/A * which is equivalent to an empty descriptor.
0N/A *
0N/A * @since 1.6
0N/A */
0N/A public MBeanParameterInfo(String name,
0N/A String type,
0N/A String description,
0N/A Descriptor descriptor) {
0N/A super(name, description, descriptor);
0N/A
0N/A this.type = type;
0N/A }
0N/A
0N/A
0N/A /**
0N/A * <p>Returns a shallow clone of this instance.
0N/A * The clone is obtained by simply calling <tt>super.clone()</tt>,
0N/A * thus calling the default native shallow cloning mechanism
0N/A * implemented by <tt>Object.clone()</tt>.
0N/A * No deeper cloning of any internal field is made.</p>
0N/A *
0N/A * <p>Since this class is immutable, cloning is chiefly of
0N/A * interest to subclasses.</p>
0N/A */
0N/A public Object clone () {
0N/A try {
0N/A return super.clone() ;
0N/A } catch (CloneNotSupportedException e) {
0N/A // should not happen as this class is cloneable
0N/A return null;
0N/A }
0N/A }
0N/A
0N/A /**
0N/A * Returns the type or class name of the data.
0N/A *
0N/A * @return the type string.
0N/A */
0N/A public String getType() {
0N/A return type;
0N/A }
0N/A
0N/A public String toString() {
0N/A return
0N/A getClass().getName() + "[" +
0N/A "description=" + getDescription() + ", " +
0N/A "name=" + getName() + ", " +
0N/A "type=" + getType() + ", " +
0N/A "descriptor=" + getDescriptor() +
0N/A "]";
0N/A }
0N/A
0N/A /**
0N/A * Compare this MBeanParameterInfo to another.
0N/A *
0N/A * @param o the object to compare to.
0N/A *
0N/A * @return true if and only if <code>o</code> is an MBeanParameterInfo such
0N/A * that its {@link #getName()}, {@link #getType()},
0N/A * {@link #getDescriptor()}, and {@link
0N/A * #getDescription()} values are equal (not necessarily identical)
0N/A * to those of this MBeanParameterInfo.
0N/A */
0N/A public boolean equals(Object o) {
0N/A if (o == this)
0N/A return true;
0N/A if (!(o instanceof MBeanParameterInfo))
0N/A return false;
0N/A MBeanParameterInfo p = (MBeanParameterInfo) o;
0N/A return (p.getName().equals(getName()) &&
0N/A p.getType().equals(getType()) &&
0N/A p.getDescription().equals(getDescription()) &&
0N/A p.getDescriptor().equals(getDescriptor()));
0N/A }
0N/A
0N/A public int hashCode() {
0N/A return getName().hashCode() ^ getType().hashCode();
0N/A }
0N/A}