- java.lang.Object
-
- javax.management.AttributeValueExp
-
- All Implemented Interfaces:
-
Serializable,ValueExp
public class AttributeValueExp extends Object implements ValueExp
表示用作关系约束的参数的属性。 该类的实例通常通过
Query.attr获得。一个
AttributeValueExp可以在任何地方使用的ValueExp是必需的。- 从以下版本开始:
- 1.5
- 另请参见:
- Serialized Form
-
-
构造方法摘要
构造方法 Constructor 描述 AttributeValueExp()已过时。使用此构造函数创建的实例不能在查询中使用。AttributeValueExp(String attr)创建一个新的AttributeValueExp表示指定的对象属性,名为attr。
-
方法摘要
所有方法 接口方法 具体的方法 弃用的方法 Modifier and Type 方法 描述 ValueExpapply(ObjectName name)将AttributeValueExp应用于MBean。protected ObjectgetAttribute(ObjectName name)返回指定的MBean中给定属性的值。StringgetAttributeName()返回属性名称的字符串表示形式。voidsetMBeanServer(MBeanServer s)已过时。此方法无效。 用于获取属性值的MBean Server为QueryEval.getMBeanServer()。StringtoString()返回表示其值的字符串。
-
-
-
构造方法详细信息
-
AttributeValueExp
@Deprecated public AttributeValueExp()
已过时。 使用此构造函数创建的实例不能在查询中使用。一个具有null属性的AttributeValueExp。
-
-
方法详细信息
-
getAttributeName
public String getAttributeName()
返回属性名称的字符串表示形式。- 结果
- 属性名称。
-
apply
public ValueExp apply(ObjectName name) throws BadStringOperationException, BadBinaryOpValueExpException, BadAttributeValueExpException, InvalidApplicationException
将
AttributeValueExp应用于MBean。 该方法调用getAttribute(name)并将结果包装为ValueExp。 返回的值getAttribute必须是Number,String,或Boolean; 否则这个方法会抛出一个BadAttributeValueExpException,这将导致这个name的包含查询为false。- Specified by:
-
apply在接口ValueExp - 参数
-
name- 要应用AttributeValueExp的MBean的名称。 - 结果
-
ValueExp。 - 异常
-
BadStringOperationException- 当一个无效的字符串操作传递给构造查询的方法时 -
BadBinaryOpValueExpException- 将无效表达式传递给构造查询的方法时 -
BadAttributeValueExpException- 当一个无效的MBean属性被传递给查询构造方法时 -
InvalidApplicationException- 尝试无效申请时
-
setMBeanServer
@Deprecated public void setMBeanServer(MBeanServer s)
设置要执行查询的MBean服务器。- Specified by:
-
setMBeanServer在接口ValueExp - 参数
-
s- 要执行查询的MBean服务器。
-
getAttribute
protected Object getAttribute(ObjectName name)
返回指定的MBean中给定属性的值。 如果访问属性的尝试生成异常,则返回null。
使用的MBean服务器是由
QueryEval.getMBeanServer()返回的。- 参数
-
name- 要返回其属性的MBean的名称。 - 结果
- the value of the attribute, or null if it could not be obtained.
-
-