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 * 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 * 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 * 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. 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 0N/A * <p>Provides general information for an MBean descriptor object. 0N/A * The feature described can be an attribute, an operation, a 0N/A * parameter, or a notification. Instances of this class are 0N/A * immutable. Subclasses may be mutable but this is not 0N/A /* Serial version */ 0N/A * The name of the feature. It is recommended that subclasses call 0N/A * {@link #getName} rather than reading this field, and that they 0N/A * @serial The name of the feature. 0N/A * The human-readable description of the feature. It is 0N/A * recommended that subclasses call {@link #getDescription} rather 0N/A * than reading this field, and that they not change it. 0N/A * @serial The human-readable description of the feature. 0N/A * @serial The Descriptor for this MBeanFeatureInfo. This field 0N/A * can be null, which is equivalent to an empty Descriptor. 0N/A * Constructs an <CODE>MBeanFeatureInfo</CODE> object. This 0N/A * constructor is equivalent to {@code MBeanFeatureInfo(name, 0N/A * description, (Descriptor) null}. 0N/A * @param name The name of the feature. 0N/A * @param description A human readable description of the feature. 0N/A * Constructs an <CODE>MBeanFeatureInfo</CODE> object. 0N/A * @param name The name of the feature. 0N/A * @param description A human readable description of the feature. 0N/A * @param descriptor The descriptor for the feature. This may be null 0N/A * which is equivalent to an empty descriptor. 0N/A * Returns the name of the feature. 0N/A * @return the name of the feature. 0N/A * Returns the human-readable description of the feature. 0N/A * @return the human-readable description of the feature. 0N/A * Returns the descriptor for the feature. Changing the returned value 0N/A * will have no affect on the original descriptor. 0N/A * @return a descriptor that is either immutable or a copy of the original. 0N/A * Compare this MBeanFeatureInfo to another. 0N/A * @param o the object to compare to. 0N/A * @return true if and only if <code>o</code> is an MBeanFeatureInfo such 0N/A * that its {@link #getName()}, {@link #getDescription()}, and 0N/A * {@link #getDescriptor()} 0N/A * values are equal (not necessarily identical) to those of this 0N/A * Serializes an {@link MBeanFeatureInfo} to an {@link ObjectOutputStream}. 0N/A * For compatibility reasons, an object of this class is serialized as follows. 0N/A * The method {@link ObjectOutputStream#defaultWriteObject defaultWriteObject()} 0N/A * is called first to serialize the object except the field {@code descriptor} 0N/A * which is declared as transient. The field {@code descriptor} is serialized 0N/A * <li>If {@code descriptor} is an instance of the class 0N/A * {@link ImmutableDescriptor}, the method {@link ObjectOutputStream#write 0N/A * write(int val)} is called to write a byte with the value {@code 1}, 0N/A * then the method {@link ObjectOutputStream#writeObject writeObject(Object obj)} 0N/A * is called twice to serialize the field names and the field values of the 0N/A * {@code descriptor}, respectively as a {@code String[]} and an 0N/A * {@code Object[]};</li> 0N/A * <li>Otherwise, the method {@link ObjectOutputStream#write write(int val)} 0N/A * is called to write a byte with the value {@code 0}, then the method 0N/A * {@link ObjectOutputStream#writeObject writeObject(Object obj)} is called 0N/A * to serialize directly the field {@code descriptor}. 0N/A * Deserializes an {@link MBeanFeatureInfo} from an {@link ObjectInputStream}. 0N/A * For compatibility reasons, an object of this class is deserialized as follows. 0N/A * The method {@link ObjectInputStream#defaultReadObject defaultReadObject()} 0N/A * is called first to deserialize the object except the field 0N/A * {@code descriptor}, which is not serialized in the default way. Then the method 0N/A * {@link ObjectInputStream#read read()} is called to read a byte, the field 0N/A * {@code descriptor} is deserialized according to the value of the byte value: 0N/A * <li>1. The method {@link ObjectInputStream#readObject readObject()} 0N/A * is called twice to obtain the field names (a {@code String[]}) and 0N/A * the field values (a {@code Object[]}) of the {@code descriptor}. 0N/A * The two obtained values then are used to construct 0N/A * an {@link ImmutableDescriptor} instance for the field 0N/A * {@code descriptor};</li> 0N/A * <li>0. The value for the field {@code descriptor} is obtained directly 0N/A * by calling the method {@link ObjectInputStream#readObject readObject()}. 0N/A * If the obtained value is null, the field {@code descriptor} is set to 0N/A * {@link ImmutableDescriptor#EMPTY_DESCRIPTOR EMPTY_DESCRIPTOR};</li> 0N/A * <li>-1. This means that there is no byte to read and that the object is from 0N/A * an earlier version of the JMX API. The field {@code descriptor} is set 0N/A * to {@link ImmutableDescriptor#EMPTY_DESCRIPTOR EMPTY_DESCRIPTOR}</li> 0N/A * <li>Any other value. A {@link StreamCorruptedException} is thrown.</li> 0N/A case -
1:
// from an earlier version of the JMX API