MBeanAttributeInfo.java revision 2362
2362N/A * Copyright (c) 1999, 2008, 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 * Describes an MBean attribute exposed for management. Instances of 0N/A * this class are immutable. Subclasses may be mutable but this is 0N/A /* Serial version */ 0N/A /* For complicated reasons, the serialVersionUID changed 0N/A between JMX 1.0 and JMX 1.1, even though JMX 1.1 did not have compatibility code for this class. So the serialization produced by this class with JMX 1.2 and jmx.serial.form=1.0 is not the same as that produced by this class with JMX 1.1 and jmx.serial.form=1.0. However, the serialization without that property is the same, and that is the only form required by JMX 1.2. long uid =
8644704819898565848L;
uid =
7043855487133450673L;
// OK: exception means no compat with 1.0, too bad * @serial The actual attribute type. * @serial The attribute write right. * @serial The attribute read right. * @serial Indicates if this method is a "is" private final boolean is;
* Constructs an <CODE>MBeanAttributeInfo</CODE> object. * @param name The name of the attribute. * @param type The type or class name of the attribute. * @param description A human readable description of the attribute. * @param isReadable True if the attribute has a getter method, false otherwise. * @param isWritable True if the attribute has a setter method, false otherwise. * @param isIs True if this attribute has an "is" getter, false otherwise. * @throws IllegalArgumentException if {@code isIs} is true but * {@code isReadable} is not, or if {@code isIs} is true and * {@code type} is not {@code boolean} or {@code java.lang.Boolean}. * (New code should always use {@code boolean} rather than * {@code java.lang.Boolean}.) * Constructs an <CODE>MBeanAttributeInfo</CODE> object. * @param name The name of the attribute. * @param type The type or class name of the attribute. * @param description A human readable description of the attribute. * @param isReadable True if the attribute has a getter method, false otherwise. * @param isWritable True if the attribute has a setter method, false otherwise. * @param isIs True if this attribute has an "is" getter, false otherwise. * @param descriptor The descriptor for the attribute. This may be null * which is equivalent to an empty descriptor. * @throws IllegalArgumentException if {@code isIs} is true but * {@code isReadable} is not, or if {@code isIs} is true and * {@code type} is not {@code boolean} or {@code java.lang.Boolean}. * (New code should always use {@code boolean} rather than * {@code java.lang.Boolean}.) "for a non-readable attribute");
"for a non-boolean attribute");
* <p>This constructor takes the name of a simple attribute, and Method * objects for reading and writing the attribute. The {@link Descriptor} * of the constructed object will include fields contributed by any * annotations on the {@code Method} objects that contain the * {@link DescriptorKey} meta-annotation. * @param name The programmatic name of the attribute. * @param description A human readable description of the attribute. * @param getter The method used for reading the attribute value. * May be null if the property is write-only. * @param setter The method used for writing the attribute value. * May be null if the attribute is read-only. * @exception IntrospectionException There is a consistency * problem in the definition of this attribute. * <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> // should not happen as this class is cloneable * Returns the class name of the attribute. * @return the class name. * Whether the value of the attribute can be read. * @return True if the attribute can be read, false otherwise. * Whether new values can be written to the attribute. * @return True if the attribute can be written to, false otherwise. * Indicates if this attribute has an "is" getter. * @return true if this attribute has an "is" getter. (
isIs() ?
"isIs, " :
"") +
* Compare this MBeanAttributeInfo to another. * @param o the object to compare to. * @return true if and only if <code>o</code> is an MBeanAttributeInfo such * that its {@link #getName()}, {@link #getType()}, {@link * #getDescription()}, {@link #isReadable()}, {@link * #isWritable()}, and {@link #isIs()} values are equal (not * necessarily identical) to those of this MBeanAttributeInfo. /* We do not include everything in the hashcode. We assume that if two operations are different they'll probably have different names or types. The penalty we pay when this assumption is wrong should be less than the penalty we would pay if it were right and we needlessly hashed in the description and parameter * Finds the type of the attribute.