01: /*
02: * Copyright (C) The MX4J Contributors.
03: * All rights reserved.
04: *
05: * This software is distributed under the terms of the MX4J License version 1.0.
06: * See the terms of the MX4J License in the documentation provided with this software.
07: */
08:
09: package javax.management;
10:
11: /**
12: * @version $Revision: 1.7 $
13: * @serial include
14: */
15: class AndQueryExp extends QueryEval implements QueryExp {
16: private static final long serialVersionUID = -1081892073854801359L;
17:
18: /**
19: * @serial The left-side expression
20: */
21: private final QueryExp exp1;
22: /**
23: * @serial The right-side expression
24: */
25: private final QueryExp exp2;
26:
27: AndQueryExp(QueryExp exp1, QueryExp exp2) {
28: this .exp1 = exp1;
29: this .exp2 = exp2;
30: }
31:
32: public void setMBeanServer(MBeanServer server) {
33: super .setMBeanServer(server);
34: if (exp1 != null)
35: exp1.setMBeanServer(server);
36: if (exp2 != null)
37: exp2.setMBeanServer(server);
38: }
39:
40: public boolean apply(ObjectName name)
41: throws BadStringOperationException,
42: BadBinaryOpValueExpException,
43: BadAttributeValueExpException, InvalidApplicationException {
44: if (exp1 != null && exp2 != null) {
45: return exp1.apply(name) && exp2.apply(name);
46: }
47: return false;
48: }
49: }
|