javax.management

Class MBeanAttributeInfo

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

Constructor Summary
MBeanAttributeInfo(String name, String desc, Method getter, Method setter)
Constructs a new {@link MBeanAttributeInfo} using the specified name and description, with the given accessor and mutator methods.
MBeanAttributeInfo(String name, String type, String desc, boolean isReadable, boolean isWritable, boolean isIs)
Constructs a new {@link MBeanAttributeInfo} using the specified name, description and type with the given settings for the accessor and mutator methods.
Method Summary
Objectclone()
Returns a clone of this instance.
booleanequals(Object obj)
Compares this feature with the supplied object.
StringgetType()
Returns the type of this attribute, in the form of its class name.
inthashCode()
Returns the hashcode of the attribute information as the sum of the hashcode of the superclass, the hashcode of the type, the hashcode of {@link #isReadable()}, twice the hashcode of {@link #isWritable()} and four times the hashcode of {@link #isIs()}.
booleanisIs()
Returns true if the accessor method of this attribute is of the form isXXX.
booleanisReadable()
Returns true if value of this attribute can be read.
booleanisWritable()
Returns true if the value of this attribute can be changed.
StringtoString()

Returns a textual representation of this instance.

Constructor Detail

MBeanAttributeInfo

public MBeanAttributeInfo(String name, String desc, Method getter, Method setter)
Constructs a new {@link 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.

MBeanAttributeInfo

public MBeanAttributeInfo(String name, String type, String desc, boolean isReadable, boolean isWritable, boolean isIs)
Constructs a new {@link 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.

Method Detail

clone

public Object clone()
Returns a clone of this instance. The clone is created using just the method provided by {@link java.lang.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.

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 {@link MBeanAttributeInfo}, {@link 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.

Parameters: obj the object to compare.

Returns: true if the object is a {@link 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 {@link #isReadable()}, twice the hashcode of {@link #isWritable()} and four times the hashcode of {@link #isIs()}.

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 {@link #isReadable()}, {@link #isWritable()} and {@link #isIs()} properties.

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

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