public boolean apply(ObjectName name) throws BadStringOperationException, BadBinaryOpValueExpException, BadAttributeValueExpException, InvalidApplicationException {
// Get the class name value
final StringValueExp val;
try {
val = (StringValueExp) classNameValue.apply(name);
} catch (ClassCastException x) {
// Should not happen - unless someone wrongly implemented
// StringValueExp.apply().
final BadStringOperationException y =
new BadStringOperationException(x.toString());
y.initCause(x);
throw y;
}
// Test whether the MBean is an instance of that class.
try {
return getMBeanServer().isInstanceOf(name, val.getValue());
} catch (InstanceNotFoundException infe) {
return false;
}
}
Applies the InstanceOf on a MBean. |