1 7 8 package javax.management; 9 10 11 17 class InstanceOfQueryExp extends QueryEval implements QueryExp { 18 19 20 private static final long serialVersionUID = -1081892073854801359L; 21 22 26 private StringValueExp classNameValue; 27 28 33 public InstanceOfQueryExp(StringValueExp classNameValue) { 41 if (classNameValue == null) { 42 throw new IllegalArgumentException ("Null class name."); 43 } 44 45 this.classNameValue = classNameValue; 46 } 47 48 53 public StringValueExp getClassNameValue() { 54 return classNameValue; 55 } 56 57 68 public boolean apply(ObjectName name) 69 throws BadStringOperationException , 70 BadBinaryOpValueExpException , 71 BadAttributeValueExpException , 72 InvalidApplicationException { 73 74 final StringValueExp val; 76 try { 77 val = (StringValueExp ) classNameValue.apply(name); 78 } catch (ClassCastException x) { 79 final BadStringOperationException y = 82 new BadStringOperationException (x.toString()); 83 y.initCause(x); 84 throw y; 85 } 86 87 try { 89 return getMBeanServer().isInstanceOf(name, val.getValue()); 90 } catch (InstanceNotFoundException infe) { 91 return false; 92 } 93 } 94 95 99 public String toString() { 100 return "InstanceOf " + classNameValue.toString(); 101 } 102 } 103 104 | Popular Tags |