public class AttributeValueExp extends Object implements ValueExp
Constructor and Description |
---|
AttributeValueExp()
Deprecated.
An instance created with a
null
attribute name can not be used in a query. |
AttributeValueExp(String attr)
Constructs a new
AttributeValueExp using the
specified attribute. |
Modifier and Type | Method and Description |
---|---|
ValueExp |
apply(ObjectName name)
Applies the
AttributeValueExp to the specified
management bean by obtaining the attribute value from
the MBeanServer and using it to create a
StringValueExp . |
protected Object |
getAttribute(ObjectName name)
Returns the value of the attribute by calling the
MBeanServer#getAttribute(ObjectName) method of
the server returned by QueryEval.getMBeanServer() . |
String |
getAttributeName()
Returns the attribute name.
|
void |
setMBeanServer(MBeanServer server)
Sets the
MBeanServer on which the query
will be performed. |
String |
toString()
Returns the attribute name, quoted.
|
@Deprecated public AttributeValueExp()
null
attribute name can not be used in a query.AttributeValueExp
.public AttributeValueExp(String attr)
AttributeValueExp
using the
specified attribute.attr
- the name of the attribute whose value
will be used for this expression.public ValueExp apply(ObjectName name) throws BadStringOperationException, BadBinaryOpValueExpException, BadAttributeValueExpException, InvalidApplicationException
AttributeValueExp
to the specified
management bean by obtaining the attribute value from
the MBeanServer
and using it to create a
StringValueExp
.apply
in interface ValueExp
name
- the ObjectName
of the bean to obtain
the value from.StringValueExp
containing the result.BadStringOperationException
- if an invalid string
operation is used by
the value expression.BadBinaryOpValueExpException
- if an invalid expression
is used by the value expression.BadAttributeValueExpException
- if an invalid attribute
is used by the value expression.InvalidApplicationException
- if the value expression is applied
to the wrong type of bean.protected Object getAttribute(ObjectName name)
MBeanServer#getAttribute(ObjectName)
method of
the server returned by QueryEval.getMBeanServer()
.
If an exception occurs, null
is returned.name
- the ObjectName
of the bean to obtain
the value from.StringValueExp
containing the result.public String getAttributeName()
public void setMBeanServer(MBeanServer server)
MBeanServer
on which the query
will be performed.setMBeanServer
in interface ValueExp
server
- the new server.public String toString()
toString
in class Object
Object.getClass()
,
Object.hashCode()
,
Class.getName()
,
Integer.toHexString(int)