FileDocCategorySizeDatePackage
ClassAttributeValueExp.javaAPI DocJava SE 5 API3438Fri Aug 26 14:57:32 BST 2005javax.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
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.

 
	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;