javax.management

Class AttributeValueExp

public class AttributeValueExp extends Object implements ValueExp

Represents an attribute value being used as an argument to a relational constraint.

Since: 1.5

Constructor Summary
AttributeValueExp(String attr)
Constructs a new {@link AttributeValueExp} using the specified attribute.
Method Summary
ValueExpapply(ObjectName name)
Applies the {@link AttributeValueExp} to the specified management bean by obtaining the attribute value from the {@link MBeanServer} and using it to create a {@link StringValueExp}.
protected ObjectgetAttribute(ObjectName name)
Returns the value of the attribute by calling the {@link MBeanServer#getAttribute(ObjectName)} method of the server returned by {@link QueryEval#getMBeanServer()}.
StringgetAttributeName()
Returns the attribute name.
voidsetMBeanServer(MBeanServer server)
Sets the {@link MBeanServer} on which the query will be performed.
StringtoString()
Returns the attribute name, quoted.

Constructor Detail

AttributeValueExp

public AttributeValueExp(String attr)
Constructs a new {@link AttributeValueExp} using the specified attribute.

Parameters: attr the name of the attribute whose value will be used for this expression.

Method Detail

apply

public ValueExp apply(ObjectName name)
Applies the {@link AttributeValueExp} to the specified management bean by obtaining the attribute value from the {@link MBeanServer} and using it to create a {@link StringValueExp}.

Parameters: name the {@link ObjectName} of the bean to obtain the value from.

Returns: a {@link StringValueExp} containing the result.

Throws: 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.

getAttribute

protected Object getAttribute(ObjectName name)
Returns the value of the attribute by calling the {@link MBeanServer#getAttribute(ObjectName)} method of the server returned by {@link QueryEval#getMBeanServer()}. If an exception occurs, null is returned.

Parameters: name the {@link ObjectName} of the bean to obtain the value from.

Returns: a {@link StringValueExp} containing the result.

getAttributeName

public String getAttributeName()
Returns the attribute name.

Returns: the attribute name.

setMBeanServer

public void setMBeanServer(MBeanServer server)
Sets the {@link MBeanServer} on which the query will be performed.

Parameters: server the new server.

toString

public String toString()
Returns the attribute name, quoted.

Returns: the quoted attribute name.