Package io.microsphere.management
Class MBeanAttribute
- java.lang.Object
-
- io.microsphere.management.MBeanAttribute
-
public class MBeanAttribute extends java.lang.Object
Represents an MBean attribute, encapsulating theMBeanAttributeInfo
and its optional value.This class provides a convenient way to work with MBean attributes by combining the metadata provided by
MBeanAttributeInfo
with the actual value of the attribute. It is particularly useful when retrieving or manipulating MBean attributes dynamically.Example Usage
// Assume mBeanInfo and attributeInfo are obtained from an MBeanServer MBeanAttribute mBeanAttribute = new MBeanAttribute(mBeanInfo, attributeInfo, value); // Get the name of the attribute String attributeName = mBeanAttribute.getName(); // Get the type of the attribute String attributeType = mBeanAttribute.getType(); // Check if the attribute is readable boolean readable = mBeanAttribute.isReadable(); // Get the value of the attribute Object attributeValue = mBeanAttribute.getValue();
- Since:
- 1.0.0
- Author:
- Mercy
- See Also:
MBeanAttributeInfo
,Attribute
-
-
Constructor Summary
Constructors Constructor Description MBeanAttribute(javax.management.MBeanInfo declaringMBeanInfo, javax.management.MBeanAttributeInfo attributeInfo, java.lang.Object value)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javax.management.MBeanAttributeInfo
getAttributeInfo()
javax.management.MBeanInfo
getDeclaringMBeanInfo()
java.lang.String
getName()
java.lang.String
getType()
java.lang.Object
getValue()
boolean
isIs()
Indicates if this attribute has an "is" getter.boolean
isReadable()
Whether the value of the attribute can be read.boolean
isWritable()
Whether new values can be written to the attribute.
-
-
-
Method Detail
-
getDeclaringMBeanInfo
@Nonnull public javax.management.MBeanInfo getDeclaringMBeanInfo()
-
getName
@Nonnull public java.lang.String getName()
- Returns:
- Get the attribute name of MBean
-
getType
@Nonnull public java.lang.String getType()
- Returns:
- Get the
string
presenting attribute type of MBeans
-
isReadable
public boolean isReadable()
Whether the value of the attribute can be read.- Returns:
- True if the attribute can be read, false otherwise.
-
isWritable
public boolean isWritable()
Whether new values can be written to the attribute.- Returns:
- True if the attribute can be written to, false otherwise.
-
isIs
public boolean isIs()
Indicates if this attribute has an "is" getter.- Returns:
- true if this attribute has an "is" getter.
-
getAttributeInfo
@Nonnull public javax.management.MBeanAttributeInfo getAttributeInfo()
- Returns:
- Get the
MBeanAttributeInfo
-
getValue
public java.lang.Object getValue()
- Returns:
- Get the attribute value of MBean, may be
null
-
-