javax.management

Class MBeanAttributeInfo

Implemented Interfaces:
Cloneable, Serializable
Known Direct Subclasses:
OpenMBeanAttributeInfoSupport

public class MBeanAttributeInfo
extends MBeanFeatureInfo
implements Cloneable

Describes the attributes of a management bean. The information in this class is immutable as standard. Of course, subclasses may change this, but this behaviour is not recommended.
Since:
1.5
See Also:
Serialized Form

Field Summary

Fields inherited from class javax.management.MBeanFeatureInfo

description, name

Constructor Summary

MBeanAttributeInfo(String name, String type, String desc, boolean isReadable, boolean isWritable, boolean isIs)
Constructs a new MBeanAttributeInfo using the specified name, description and type with the given settings for the accessor and mutator methods.
MBeanAttributeInfo(String name, String desc, Method getter, Method setter)
Constructs a new MBeanAttributeInfo using the specified name and description, with the given accessor and mutator methods.

Method Summary

Object
clone()
Returns a clone of this instance.
boolean
equals(Object obj)
Compares this feature with the supplied object.
String
getType()
Returns the type of this attribute, in the form of its class name.
int
hashCode()
Returns the hashcode of the attribute information as the sum of the hashcode of the superclass, the hashcode of the type, the hashcode of isReadable(), twice the hashcode of isWritable() and four times the hashcode of isIs().
boolean
isIs()
Returns true if the accessor method of this attribute is of the form isXXX.
boolean
isReadable()
Returns true if value of this attribute can be read.
boolean
isWritable()
Returns true if the value of this attribute can be changed.
String
toString()
Returns a textual representation of this instance.

Methods inherited from class javax.management.MBeanFeatureInfo

equals, getDescription, getName, hashCode, toString

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Details

MBeanAttributeInfo

public MBeanAttributeInfo(String name,
                          String type,
                          String desc,
                          boolean isReadable,
                          boolean isWritable,
                          boolean isIs)
Constructs a new MBeanAttributeInfo using the specified name, description and type with the given settings for the accessor and mutator methods.
Parameters:
name - the name of the attribute.
type - the type of the attribute, in the form of its class name.
desc - a description of the attribute.
isReadable - true if the attribute's value can be read.
isWritable - true if the attribute's value can be changed.
isIs - true if the attribute uses an accessor of the form isXXX.
Throws:
IllegalArgumentException - if the attribute is both unreadable and unwritable.

MBeanAttributeInfo

public MBeanAttributeInfo(String name,
                          String desc,
                          Method getter,
                          Method setter)
            throws IntrospectionException
Constructs a new MBeanAttributeInfo using the specified name and description, with the given accessor and mutator methods. A null value for the accessor method indicates that the value can not be read. A null value for the mutator method indicates that the value can not be changed.
Parameters:
name - the name of the attribute.
desc - a description of the attribute.
getter - the accessor method, or null if the value can not be read.
setter - the mutator method, or null if the value can not be changed.
Throws:
IntrospectionException - if both the accessor and mutator method are null.

Method Details

clone

public Object clone()
Returns a clone of this instance. The clone is created using just the method provided by Object. Thus, the clone is just a shallow clone as returned by that method, and does not contain any deeper cloning based on the subject of this class.
Overrides:
clone in interface Object
Returns:
a clone of this instance.
See Also:
Cloneable

equals

public boolean equals(Object obj)
Compares this feature with the supplied object. This returns true iff the object is an instance of MBeanAttributeInfo, Object.equals() returns true for a comparison of both the name and description of this attribute with that of the specified object (performed by the superclass), and the type and boolean flags of the two instances are equal.
Overrides:
equals in interface MBeanFeatureInfo
Parameters:
obj - the object to compare.
Returns:
true if the object is a MBeanAttributeInfo instance, name.equals(object.getName()), description.equals(object.getDescription()), attributeType.equals(object.getType()), isRead == object.isReadable(), isWrite == object.isWritable(), is == object.isIs()

getType

public String getType()
Returns the type of this attribute, in the form of its class name.
Returns:
the type of this attribute.

hashCode

public int hashCode()
Returns the hashcode of the attribute information as the sum of the hashcode of the superclass, the hashcode of the type, the hashcode of isReadable(), twice the hashcode of isWritable() and four times the hashcode of isIs().
Overrides:
hashCode in interface MBeanFeatureInfo
Returns:
the hashcode of the attribute information.

isIs

public boolean isIs()
Returns true if the accessor method of this attribute is of the form isXXX.
Returns:
true if the accessor takes the form isXXX.

isReadable

public boolean isReadable()
Returns true if value of this attribute can be read.
Returns:
true if the value of the attribute can be read.

isWritable

public boolean isWritable()
Returns true if the value of this attribute can be changed.
Returns:
true if the value of the attribute can be changed.

toString

public String toString()
Returns a textual representation of this instance. This is constructed using the class name (javax.management.MBeanAttributeInfo), the name, description and type of the attribute and the current settings of the isReadable(), isWritable() and isIs() properties.

As instances of this class are immutable, the return value is computed just once for each instance and reused throughout its life.

Overrides:
toString in interface MBeanFeatureInfo
Returns:
a @link{java.lang.String} instance representing the instance in textual form.

MBeanAttributeInfo.java -- Information about an attribute of a bean. Copyright (C) 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.