jdk/src/share/classes/javax/management/Query.java
author duke
Sat, 01 Dec 2007 00:00:00 +0000
changeset 2 90ce3da70b43
child 34 2d042367885f
permissions -rw-r--r--
Initial load
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
 * Copyright 1999-2005 Sun Microsystems, Inc.  All Rights Reserved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 * have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package javax.management;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 * <p>Constructs query object constraints. The static methods provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * return query expressions that may be used in listing and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * enumerating MBeans. Individual constraint construction methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * allow only appropriate types as arguments. Composition of calls can
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * construct arbitrary nestings of constraints, as the following
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * example illustrates:</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * QueryExp exp = Query.and(Query.gt(Query.attr("age"),Query.value(5)),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 *                          Query.match(Query.attr("name"),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 *                                      Query.value("Smith")));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * @since 1.5
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 public class Query extends Object   {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
      * A code representing the {@link Query#gt} query.  This is chiefly
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
      * of interest for the serialized form of queries.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
     public static final int GT  = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
      * A code representing the {@link Query#lt} query.  This is chiefly
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
      * of interest for the serialized form of queries.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
     public static final int LT  = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
      * A code representing the {@link Query#geq} query.  This is chiefly
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
      * of interest for the serialized form of queries.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
     public static final int GE  = 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
      * A code representing the {@link Query#leq} query.  This is chiefly
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
      * of interest for the serialized form of queries.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     public static final int LE  = 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
      * A code representing the {@link Query#eq} query.  This is chiefly
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
      * of interest for the serialized form of queries.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     public static final int EQ  = 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
      * A code representing the {@link Query#plus} expression.  This
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
      * is chiefly of interest for the serialized form of queries.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     public static final int PLUS  = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
      * A code representing the {@link Query#minus} expression.  This
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
      * is chiefly of interest for the serialized form of queries.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     public static final int MINUS = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
      * A code representing the {@link Query#times} expression.  This
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
      * is chiefly of interest for the serialized form of queries.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     public static final int TIMES = 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
      * A code representing the {@link Query#div} expression.  This is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
      * chiefly of interest for the serialized form of queries.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     public static final int DIV   = 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
      * Basic constructor.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     public Query() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
      * Returns a query expression that is the conjunction of two other query
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
      * expressions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
      * @param q1 A query expression.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
      * @param q2 Another query expression.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
      * @return  The conjunction of the two arguments.  The returned object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
      * will be serialized as an instance of the non-public class {@link
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
      * <a href="../../serialized-form.html#javax.management.AndQueryExp">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
      * javax.management.AndQueryExp</a>}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     public static QueryExp and(QueryExp q1, QueryExp q2)  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
         return new AndQueryExp(q1, q2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
      * Returns a query expression that is the disjunction of two other query
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
      * expressions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
      * @param q1 A query expression.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
      * @param q2 Another query expression.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
      * @return  The disjunction of the two arguments.  The returned object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
      * will be serialized as an instance of the non-public class {@link
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
      * <a href="../../serialized-form.html#javax.management.OrQueryExp">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
      * javax.management.OrQueryExp</a>}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     public static QueryExp or(QueryExp q1, QueryExp q2)  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
         return new OrQueryExp(q1, q2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
      * Returns a query expression that represents a "greater than" constraint on
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
      * two values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
      * @param v1 A value expression.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
      * @param v2 Another value expression.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
      * @return A "greater than" constraint on the arguments.  The
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
      * returned object will be serialized as an instance of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
      * non-public class {@link <a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
      * href="../../serialized-form.html#javax.management.BinaryRelQueryExp">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
      * javax.management.BinaryRelQueryExp</a>} with a {@code relOp} equal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
      * to {@link #GT}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     public static QueryExp gt(ValueExp v1, ValueExp v2)  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
         return new BinaryRelQueryExp(GT, v1, v2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
      * Returns a query expression that represents a "greater than or equal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
      * to" constraint on two values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
      * @param v1 A value expression.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
      * @param v2 Another value expression.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
      * @return A "greater than or equal to" constraint on the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
      * arguments.  The returned object will be serialized as an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
      * instance of the non-public class {@link <a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
      * href="../../serialized-form.html#javax.management.BinaryRelQueryExp">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
      * javax.management.BinaryRelQueryExp</a>} with a {@code relOp} equal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
      * to {@link #GE}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     public static QueryExp geq(ValueExp v1, ValueExp v2)  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
         return new BinaryRelQueryExp(GE, v1, v2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
      * Returns a query expression that represents a "less than or equal to"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
      * constraint on two values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
      * @param v1 A value expression.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
      * @param v2 Another value expression.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
      * @return A "less than or equal to" constraint on the arguments.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
      * The returned object will be serialized as an instance of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
      * non-public class {@link <a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
      * href="../../serialized-form.html#javax.management.BinaryRelQueryExp">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
      * javax.management.BinaryRelQueryExp</a>} with a {@code relOp} equal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
      * to {@link #LE}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     public static QueryExp leq(ValueExp v1, ValueExp v2)  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
         return new BinaryRelQueryExp(LE, v1, v2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
      * Returns a query expression that represents a "less than" constraint on
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
      * two values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
      * @param v1 A value expression.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
      * @param v2 Another value expression.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
      * @return A "less than" constraint on the arguments.  The
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
      * returned object will be serialized as an instance of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
      * non-public class {@link <a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
      * href="../../serialized-form.html#javax.management.BinaryRelQueryExp">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
      * javax.management.BinaryRelQueryExp</a>} with a {@code relOp} equal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
      * to {@link #LT}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     public static QueryExp lt(ValueExp v1, ValueExp v2)  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
         return new BinaryRelQueryExp(LT, v1, v2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
      * Returns a query expression that represents an equality constraint on
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
      * two values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
      * @param v1 A value expression.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
      * @param v2 Another value expression.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
      * @return A "equal to" constraint on the arguments.  The
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
      * returned object will be serialized as an instance of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
      * non-public class {@link <a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
      * href="../../serialized-form.html#javax.management.BinaryRelQueryExp">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
      * javax.management.BinaryRelQueryExp</a>} with a {@code relOp} equal
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
      * to {@link #EQ}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
     public static QueryExp eq(ValueExp v1, ValueExp v2)  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
         return new BinaryRelQueryExp(EQ, v1, v2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
      * Returns a query expression that represents the constraint that one
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
      * value is between two other values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
      * @param v1 A value expression that is "between" v2 and v3.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
      * @param v2 Value expression that represents a boundary of the constraint.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
      * @param v3 Value expression that represents a boundary of the constraint.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
      * @return The constraint that v1 lies between v2 and v3.  The
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
      * returned object will be serialized as an instance of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
      * non-public class {@link <a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
      * href="../../serialized-form.html#javax.management.BetweenQueryExp">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
      * javax.management.BetweenQueryExp</a>}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
     public static QueryExp between(ValueExp v1, ValueExp v2, ValueExp v3) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
         return new BetweenQueryExp(v1, v2, v3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
      * Returns a query expression that represents a matching constraint on
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
      * a string argument. The matching syntax is consistent with file globbing:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
      * supports "<code>?</code>", "<code>*</code>", "<code>[</code>",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
      * each of which may be escaped with "<code>\</code>";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
      * character classes may use "<code>!</code>" for negation and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
      * "<code>-</code>" for range.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
      * (<code>*</code> for any character sequence,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
      * <code>?</code> for a single arbitrary character,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
      * <code>[...]</code> for a character sequence).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
      * For example: <code>a*b?c</code> would match a string starting
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
      * with the character <code>a</code>, followed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
      * by any number of characters, followed by a <code>b</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
      * any single character, and a <code>c</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
      * @param a An attribute expression
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
      * @param s A string value expression representing a matching constraint
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
      * @return A query expression that represents the matching
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
      * constraint on the string argument.  The returned object will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
      * be serialized as an instance of the non-public class {@link <a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
      * href="../../serialized-form.html#javax.management.MatchQueryExp">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
      * javax.management.MatchQueryExp</a>}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
     public static QueryExp match(AttributeValueExp a, StringValueExp s)  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
         return new MatchQueryExp(a, s);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
      * <p>Returns a new attribute expression.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
      * <p>Evaluating this expression for a given
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
      * <code>objectName</code> includes performing {@link
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
      * MBeanServer#getAttribute MBeanServer.getAttribute(objectName,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
      * name)}.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
      * @param name The name of the attribute.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
      * @return  An attribute expression for the attribute named name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
     public static AttributeValueExp attr(String name)  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
         return new AttributeValueExp(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
      * <p>Returns a new qualified attribute expression.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
      * <p>Evaluating this expression for a given
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
      * <code>objectName</code> includes performing {@link
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
      * MBeanServer#getObjectInstance
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
      * MBeanServer.getObjectInstance(objectName)} and {@link
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
      * MBeanServer#getAttribute MBeanServer.getAttribute(objectName,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
      * name)}.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
      * @param className The name of the class possessing the attribute.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
      * @param name The name of the attribute.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
      * @return An attribute expression for the attribute named name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
      * The returned object will be serialized as an instance of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
      * non-public class {@link <a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
      * href="../../serialized-form.html#javax.management.QualifiedAttributeValueExp">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
      * javax.management.QualifiedAttributeValueExp</a>}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
     public static AttributeValueExp attr(String className, String name)  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
         return new QualifiedAttributeValueExp(className, name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
      * <p>Returns a new class attribute expression which can be used in any
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
      * Query call that expects a ValueExp.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
      * <p>Evaluating this expression for a given
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
      * <code>objectName</code> includes performing {@link
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
      * MBeanServer#getObjectInstance
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
      * MBeanServer.getObjectInstance(objectName)}.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
      * @return A class attribute expression.  The returned object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
      * will be serialized as an instance of the non-public class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
      * {@link <a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
      * href="../../serialized-form.html#javax.management.ClassAttributeValueExp">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
      * javax.management.ClassAttributeValueExp</a>}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
     public static AttributeValueExp classattr()  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
         return new ClassAttributeValueExp();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
      * Returns a constraint that is the negation of its argument.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
      * @param queryExp The constraint to negate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
      * @return A negated constraint.  The returned object will be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
      * serialized as an instance of the non-public class {@link <a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
      * href="../../serialized-form.html#javax.management.NotQueryExp">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
      * javax.management.NotQueryExp</a>}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
     public static QueryExp not(QueryExp queryExp)  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
         return new NotQueryExp(queryExp);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
      * Returns an expression constraining a value to be one of an explicit list.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
      * @param val A value to be constrained.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
      * @param valueList An array of ValueExps.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
      * @return A QueryExp that represents the constraint.  The
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
      * returned object will be serialized as an instance of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
      * non-public class {@link <a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
      * href="../../serialized-form.html#javax.management.InQueryExp">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
      * javax.management.InQueryExp</a>}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
     public static QueryExp in(ValueExp val, ValueExp valueList[])  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
         return new InQueryExp(val, valueList);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
      * Returns a new string expression.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
      * @param val The string value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
      * @return  A ValueExp object containing the string argument.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
     public static StringValueExp value(String val)  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
         return new StringValueExp(val);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
      * Returns a numeric value expression that can be used in any Query call
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
      * that expects a ValueExp.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
      * @param val An instance of Number.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
      * @return A ValueExp object containing the argument.  The
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
      * returned object will be serialized as an instance of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
      * non-public class {@link <a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
      * href="../../serialized-form.html#javax.management.NumericValueExp">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
      * javax.management.NumericValueExp</a>}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
     public static ValueExp value(Number val)  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
         return new NumericValueExp(val);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
      * Returns a numeric value expression that can be used in any Query call
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
      * that expects a ValueExp.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
      * @param val An int value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
      * @return A ValueExp object containing the argument.  The
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
      * returned object will be serialized as an instance of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
      * non-public class {@link <a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
      * href="../../serialized-form.html#javax.management.NumericValueExp">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
      * javax.management.NumericValueExp</a>}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
     public static ValueExp value(int val)  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
         return new NumericValueExp((long) val);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
      * Returns a numeric value expression that can be used in any Query call
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
      * that expects a ValueExp.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
      * @param val A long value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
      * @return A ValueExp object containing the argument.  The
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
      * returned object will be serialized as an instance of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
      * non-public class {@link <a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
      * href="../../serialized-form.html#javax.management.NumericValueExp">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
      * javax.management.NumericValueExp</a>}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
     public static ValueExp value(long val)  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
         return new NumericValueExp(val);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
      * Returns a numeric value expression that can be used in any Query call
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
      * that expects a ValueExp.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
      * @param val A float value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
      * @return A ValueExp object containing the argument.  The
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
      * returned object will be serialized as an instance of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
      * non-public class {@link <a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
      * href="../../serialized-form.html#javax.management.NumericValueExp">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
      * javax.management.NumericValueExp</a>}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
     public static ValueExp value(float val)  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
         return new NumericValueExp((double) val);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
      * Returns a numeric value expression that can be used in any Query call
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
      * that expects a ValueExp.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
      * @param val A double value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
      * @return  A ValueExp object containing the argument.  The
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
      * returned object will be serialized as an instance of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
      * non-public class {@link <a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
      * href="../../serialized-form.html#javax.management.NumericValueExp">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
      * javax.management.NumericValueExp</a>}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
     public static ValueExp value(double val)  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
         return new NumericValueExp(val);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
      * Returns a boolean value expression that can be used in any Query call
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
      * that expects a ValueExp.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
      * @param val A boolean value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
      * @return A ValueExp object containing the argument.  The
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
      * returned object will be serialized as an instance of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
      * non-public class {@link <a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
      * href="../../serialized-form.html#javax.management.BooleanValueExp">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
      * javax.management.BooleanValueExp</a>}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
     public static ValueExp value(boolean val)  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
         return new BooleanValueExp(val);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
      * Returns a binary expression representing the sum of two numeric values,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
      * or the concatenation of two string values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
      * @param value1 The first '+' operand.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
      * @param value2 The second '+' operand.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
      * @return A ValueExp representing the sum or concatenation of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
      * the two arguments.  The returned object will be serialized as
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
      * an instance of the non-public class {@link <a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
      * href="../../serialized-form.html#javax.management.BinaryOpValueExp">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
      * javax.management.BinaryOpValueExp</a>} with an {@code op} equal to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
      * {@link #PLUS}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
     public static ValueExp plus(ValueExp value1, ValueExp value2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
         return new BinaryOpValueExp(PLUS, value1, value2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
      * Returns a binary expression representing the product of two numeric values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
      * @param value1 The first '*' operand.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
      * @param value2 The second '*' operand.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
      * @return A ValueExp representing the product.  The returned
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
      * object will be serialized as an instance of the non-public
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
      * class {@link <a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
      * href="../../serialized-form.html#javax.management.BinaryOpValueExp">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
      * javax.management.BinaryOpValueExp</a>} with an {@code op} equal to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
      * {@link #TIMES}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
     public static ValueExp times(ValueExp value1,ValueExp value2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
         return new BinaryOpValueExp(TIMES, value1, value2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
      * Returns a binary expression representing the difference between two numeric
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
      * values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
      * @param value1 The first '-' operand.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
      * @param value2 The second '-' operand.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
      * @return A ValueExp representing the difference between two
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
      * arguments.  The returned object will be serialized as an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
      * instance of the non-public class {@link <a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
      * href="../../serialized-form.html#javax.management.BinaryOpValueExp">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
      * javax.management.BinaryOpValueExp</a>} with an {@code op} equal to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
      * {@link #MINUS}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
     public static ValueExp minus(ValueExp value1, ValueExp value2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
         return new BinaryOpValueExp(MINUS, value1, value2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
      * Returns a binary expression representing the quotient of two numeric
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
      * values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
      * @param value1 The first '/' operand.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
      * @param value2 The second '/' operand.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
      * @return A ValueExp representing the quotient of two arguments.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
      * The returned object will be serialized as an instance of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
      * non-public class {@link <a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
      * href="../../serialized-form.html#javax.management.BinaryOpValueExp">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
      * javax.management.BinaryOpValueExp</a>} with an {@code op} equal to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
      * {@link #DIV}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
     public static ValueExp div(ValueExp value1, ValueExp value2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
         return new BinaryOpValueExp(DIV, value1, value2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
      * Returns a query expression that represents a matching constraint on
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
      * a string argument. The value must start with the given literal string
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
      * value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
      * @param a An attribute expression.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
      * @param s A string value expression representing the beginning of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
      * string value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
      * @return The constraint that a matches s.  The returned object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
      * will be serialized as an instance of the non-public class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
      * {@link <a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
      * href="../../serialized-form.html#javax.management.MatchQueryExp">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
      * javax.management.MatchQueryExp</a>}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
     public static QueryExp initialSubString(AttributeValueExp a, StringValueExp s)  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
         return new MatchQueryExp(a,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
             new StringValueExp(escapeString(s.getValue()) + "*"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
      * Returns a query expression that represents a matching constraint on
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
      * a string argument. The value must contain the given literal string
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
      * value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
      * @param a An attribute expression.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
      * @param s A string value expression representing the substring.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
      * @return The constraint that a matches s.  The returned object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
      * will be serialized as an instance of the non-public class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
      * {@link <a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
      * href="../../serialized-form.html#javax.management.MatchQueryExp">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
      * javax.management.MatchQueryExp</a>}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
     public static QueryExp anySubString(AttributeValueExp a, StringValueExp s) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
         return new MatchQueryExp(a,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
             new StringValueExp("*" + escapeString(s.getValue()) + "*"));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
      * Returns a query expression that represents a matching constraint on
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
      * a string argument. The value must end with the given literal string
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
      * value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
      * @param a An attribute expression.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
      * @param s A string value expression representing the end of the string
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
      * value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
      * @return The constraint that a matches s.  The returned object
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
      * will be serialized as an instance of the non-public class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
      * {@link <a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
      * href="../../serialized-form.html#javax.management.MatchQueryExp">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
      * javax.management.MatchQueryExp</a>}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
     public static QueryExp finalSubString(AttributeValueExp a, StringValueExp s) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
         return new MatchQueryExp(a,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
             new StringValueExp("*" + escapeString(s.getValue())));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
      * Returns a query expression that represents an inheritance constraint
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
      * on an MBean class.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
      * <p>Example: to find MBeans that are instances of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
      * {@link NotificationBroadcaster}, use
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
      * {@code Query.isInstanceOf(Query.value(NotificationBroadcaster.class.getName()))}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
      * </p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
      * <p>Evaluating this expression for a given
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
      * <code>objectName</code> includes performing {@link
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
      * MBeanServer#isInstanceOf MBeanServer.isInstanceOf(objectName,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
      * ((StringValueExp)classNameValue.apply(objectName)).getValue()}.</p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
      *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
      * @param classNameValue The {@link StringValueExp} returning the name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
      *        of the class of which selected MBeans should be instances.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
      * @return a query expression that represents an inheritance
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
      * constraint on an MBean class.  The returned object will be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
      * serialized as an instance of the non-public class {@link <a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
      * href="../../serialized-form.html#javax.management.InstanceOfQueryExp">
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
      * javax.management.InstanceOfQueryExp</a>}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
      * @since 1.6
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
     public static QueryExp isInstanceOf(StringValueExp classNameValue) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
        return new InstanceOfQueryExp(classNameValue);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
      * Utility method to escape strings used with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
      * Query.{initial|any|final}SubString() methods.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
     private static String escapeString(String s) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
         if (s == null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
             return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
         s = s.replace("\\", "\\\\");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
         s = s.replace("*", "\\*");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
         s = s.replace("?", "\\?");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
         s = s.replace("[", "\\[");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
         return s;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
     }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
 }