javax.management
Class MBeanAttributeInfo

java.lang.Object
  extended by javax.management.MBeanFeatureInfo
      extended by javax.management.MBeanAttributeInfo
All Implemented Interfaces:
Serializable, Cloneable
Direct Known 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 desc, Method getter, Method setter)
          Constructs a new 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 MBeanAttributeInfo using the specified name, description and type with the given settings for the 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
getDescription, getName
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

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.

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.
Method Detail

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 class 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 class 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()
See Also:
Object.hashCode()

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 class MBeanFeatureInfo
Returns:
the hashcode of the attribute information.
See Also:
Object.equals(Object), System.identityHashCode(Object)

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 class MBeanFeatureInfo
Returns:
a @link{java.lang.String} instance representing the instance in textual form.
See Also:
Object.getClass(), Object.hashCode(), Class.getName(), Integer.toHexString(int)