FileDocCategorySizeDatePackage
ClassAttributeValueExp.javaAPI DocJava SE 6 API3727Tue Jun 10 00:26:12 BST 2008javax.management

ClassAttributeValueExp

public class ClassAttributeValueExp extends AttributeValueExp
This class represents the name of the Java implementation class of the MBean. It is used for performing queries based on the class of the MBean.
serial
include

The serialVersionUID of this class is -1081892073854801359L.

since
1.5

Fields Summary
private static final long
oldSerialVersionUID
private static final long
newSerialVersionUID
private static final long
serialVersionUID
private String
attr
Constructors Summary
public ClassAttributeValueExp()
Basic Constructor.

	/* Compatibility: we have an attr field that we must hold on to
	   for serial compatibility, even though our parent has one too.  */
	super("Class");
	attr = "Class";
    
Methods Summary
public javax.management.ValueExpapply(javax.management.ObjectName name)
Applies the ClassAttributeValueExp on an MBean. Returns the name of the Java implementation class of the MBean.

param
name The name of the MBean on which the ClassAttributeValueExp will be applied.
return
The ValueExp.
exception
BadAttributeValueExpException
exception
InvalidApplicationException

	// getAttribute(name);
	Object result = getValue(name);
	if  (result instanceof String) {
	    return new StringValueExp((String)result);
	} else {
	    throw new BadAttributeValueExpException(result);
	}
    
protected java.lang.ObjectgetValue(javax.management.ObjectName name)

	try {
	    // Get the class of the object
	    MBeanServer server = QueryEval.getMBeanServer();
	    return server.getObjectInstance(name).getClassName();
	} catch (Exception re) {
	    return null;
	    /* In principle the MBean does exist because otherwise we
	       wouldn't be evaluating the query on it.  But it could
	       potentially have disappeared in between the time we
	       discovered it and the time the query is evaluated.

	       Also, the exception could be a SecurityException.

	       Returning null from here will cause
	       BadAttributeValueExpException, which will in turn cause
	       this MBean to be omitted from the query result.  */
	}
    
public java.lang.StringtoString()
Returns the string "Class" representing its value

	return attr;