KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > management > NotQueryExp


1 /*
2  * @(#)NotQueryExp.java 4.17 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package javax.management;
9
10
11 /**
12  * This class is used by the query-building mechanism to represent negations
13  * of relational expressions.
14  * @serial include
15  *
16  * @since 1.5
17  */

18 class NotQueryExp extends QueryEval JavaDoc implements QueryExp JavaDoc {
19
20
21     /* Serial version */
22     private static final long serialVersionUID = 5269643775896723397L;
23
24     /**
25      * @serial The negated {@link QueryExp}
26      */

27     private QueryExp JavaDoc exp;
28     
29
30     /**
31      * Basic Constructor.
32      */

33     public NotQueryExp() {
34     }
35     
36     /**
37      * Creates a new NotQueryExp for negating the specified QueryExp.
38      */

39     public NotQueryExp(QueryExp JavaDoc q) {
40     exp = q;
41     }
42
43
44     /**
45      * Returns the negated query expression of the query.
46      */

47     public QueryExp JavaDoc getNegatedExp() {
48     return exp;
49     }
50
51     /**
52      * Applies the NotQueryExp on a MBean.
53      *
54      * @param name The name of the MBean on which the NotQueryExp will be applied.
55      *
56      * @return True if the query was successfully applied to the MBean, false otherwise.
57      *
58      * @exception BadStringOperationException
59      * @exception BadBinaryOpValueExpException
60      * @exception BadAttributeValueExpException
61      * @exception InvalidApplicationException
62      */

63     public boolean apply(ObjectName JavaDoc name) throws BadStringOperationException JavaDoc, BadBinaryOpValueExpException JavaDoc,
64     BadAttributeValueExpException JavaDoc, InvalidApplicationException JavaDoc {
65     return exp.apply(name) == false;
66     }
67
68     /**
69      * Returns the string representing the object.
70      */

71     public String JavaDoc toString() {
72     return "not (" + exp + ")";
73     }
74
75  }
76
Popular Tags