Constructs query object constraints.
The MBean Server can be queried for MBeans that meet a particular
condition, using its queryNames or
queryMBeans method. The QueryExp
parameter to the method can be any implementation of the interface
QueryExp, but it is usually best to obtain the QueryExp
value by calling the static methods in this class. This is particularly
true when querying a remote MBean Server: a custom implementation of the
QueryExp interface might not be present in the remote MBean Server,
but the methods in this class return only standard classes that are
part of the JMX implementation.
As an example, suppose you wanted to find all MBeans where the Enabled attribute is true and the Owner attribute is "Duke". Here is how you could construct the appropriate QueryExp by
chaining together method calls:
QueryExp query =
Query.and(Query.eq(Query.attr("Enabled"), Query.value(true)),
Query.eq(Query.attr("Owner"), Query.value("Duke")));
| Modifier and Type | Field and Description |
|---|---|
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | MINUS
A code representing the |
| public static final int | PLUS
A code representing the |
| public static final int | TIMES
A code representing the |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static QueryExp | Returns: The conjunction of the two arguments. The returned object will be serialized as an instance of the non-public class javax.management.AndQueryExp.A query expression. q1, QueryExp Another query expression. q2)Returns a query expression that is the conjunction of two other query expressions. |
| public static QueryExp | Returns: The constraint that a matches s. The returned object will be serialized as an instance of the non-public class javax.management.MatchQueryExp.An attribute expression. a, StringValueExp A string value expression representing the substring. s)Returns a query expression that represents a matching constraint on a string argument. |
| public static AttributeValueExp | |
| public static AttributeValueExp | Returns: An attribute expression for the attribute named name. The returned object will be serialized as an instance of the non-public class javax.management.QualifiedAttributeValueExp.The name of the class possessing the attribute. className, String The name of the attribute. name)Returns a new qualified attribute expression. |
| public static QueryExp | Returns: The constraint that v1 lies between v2 and v3. The returned object will be serialized as an instance of the non-public class javax.management.BetweenQueryExp.A value expression that is "between" v2 and v3. v1, ValueExp Value expression that represents a boundary of the constraint. v2, ValueExp Value expression that represents a boundary of the constraint. v3)Returns a query expression that represents the constraint that one value is between two other values. |
| public static AttributeValueExp | Returns: A class attribute expression. The returned object will be serialized as an instance of the non-public class javax.management.ClassAttributeValueExp.Returns a new class attribute expression which can be used in any Query call that expects a ValueExp. |
| public static ValueExp | Returns: A ValueExp representing the quotient of two arguments. The returned object will be serialized as an instance of the non-public class javax.management.BinaryOpValueExp with anop equal to
DIV.The first '/' operand. value1, ValueExp The second '/' operand. value2)Returns a binary expression representing the quotient of two numeric values. |
| public static QueryExp | Returns: A "equal to" constraint on the arguments. The returned object will be serialized as an instance of the non-public class javax.management.BinaryRelQueryExp with arelOp equal
to EQ.A value expression. v1, ValueExp Another value expression. v2)Returns a query expression that represents an equality constraint on two values. |
| private static String | escapeString(String s)
Utility method to escape strings used with Query.{initial|any|final}SubString() methods. |
| public static QueryExp | Returns: The constraint that a matches s. The returned object will be serialized as an instance of the non-public class javax.management.MatchQueryExp.An attribute expression. a, StringValueExp A string value expression representing the end of the string
value. s)Returns a query expression that represents a matching constraint on a string argument. |
| public static QueryExp | Returns: A "greater than or equal to" constraint on the arguments. The returned object will be serialized as an instance of the non-public class javax.management.BinaryRelQueryExp with arelOp equal
to GE.A value expression. v1, ValueExp Another value expression. v2)Returns a query expression that represents a "greater than or equal to" constraint on two values. |
| public static QueryExp | Returns: A "greater than" constraint on the arguments. The returned object will be serialized as an instance of the non-public class javax.management.BinaryRelQueryExp with arelOp equal
to GT.A value expression. v1, ValueExp Another value expression. v2)Returns a query expression that represents a "greater than" constraint on two values. |
| public static QueryExp | Returns: A QueryExp that represents the constraint. The returned object will be serialized as an instance of the non-public class javax.management.InQueryExp.A value to be constrained. val, ValueExp[] An array of ValueExps. valueList)Returns an expression constraining a value to be one of an explicit list. |
| public static QueryExp | Returns: The constraint that a matches s. The returned object will be serialized as an instance of the non-public class javax.management.MatchQueryExp.An attribute expression. a, StringValueExp A string value expression representing the beginning of the
string value. s)Returns a query expression that represents a matching constraint on a string argument. |
| public static QueryExp | Returns: a query expression that represents an inheritance constraint on an MBean class. The returned object will be serialized as an instance of the non-public class javax.management.InstanceOfQueryExp.The classNameValue)StringValueExp returning the name
of the class of which selected MBeans should be instances.Returns a query expression that represents an inheritance constraint on an MBean class. |
| public static QueryExp | Returns: A "less than or equal to" constraint on the arguments. The returned object will be serialized as an instance of the non-public class javax.management.BinaryRelQueryExp with arelOp equal
to LE.A value expression. v1, ValueExp Another value expression. v2)Returns a query expression that represents a "less than or equal to" constraint on two values. |
| public static QueryExp | Returns: A "less than" constraint on the arguments. The returned object will be serialized as an instance of the non-public class javax.management.BinaryRelQueryExp with arelOp equal
to LT.A value expression. v1, ValueExp Another value expression. v2)Returns a query expression that represents a "less than" constraint on two values. |
| public static QueryExp | Returns: A query expression that represents the matching constraint on the string argument. The returned object will be serialized as an instance of the non-public class javax.management.MatchQueryExp.An attribute expression a, StringValueExp A string value expression representing a matching constraint s)Returns a query expression that represents a matching constraint on a string argument. |
| public static ValueExp | Returns: A ValueExp representing the difference between two arguments. The returned object will be serialized as an instance of the non-public class javax.management.BinaryOpValueExp with anop equal to
MINUS.The first '-' operand. value1, ValueExp The second '-' operand. value2)Returns a binary expression representing the difference between two numeric values. |
| public static QueryExp | Returns: A negated constraint. The returned object will be serialized as an instance of the non-public class javax.management.NotQueryExp.The constraint to negate. queryExp)Returns a constraint that is the negation of its argument. |
| public static QueryExp | Returns: The disjunction of the two arguments. The returned object will be serialized as an instance of the non-public class javax.management.OrQueryExp.A query expression. q1, QueryExp Another query expression. q2)Returns a query expression that is the disjunction of two other query expressions. |
| public static ValueExp | Returns: A ValueExp representing the sum or concatenation of the two arguments. The returned object will be serialized as an instance of the non-public class javax.management.BinaryOpValueExp with anop equal to
PLUS.The first '+' operand. value1, ValueExp The second '+' operand. value2)Returns a binary expression representing the sum of two numeric values, or the concatenation of two string values. |
| public static ValueExp | Returns: A ValueExp representing the product. The returned object will be serialized as an instance of the non-public class javax.management.BinaryOpValueExp with anop equal to
TIMES.The first '*' operand. value1, ValueExp The second '*' operand. value2)Returns a binary expression representing the product of two numeric values. |
| public static StringValueExp | |
| public static ValueExp | Returns: A ValueExp object containing the argument. The returned object will be serialized as an instance of the non-public class javax.management.NumericValueExp.An instance of Number. val)Returns a numeric value expression that can be used in any Query call that expects a ValueExp. |
| public static ValueExp | Returns: A ValueExp object containing the argument. The returned object will be serialized as an instance of the non-public class javax.management.NumericValueExp.An int value. val)Returns a numeric value expression that can be used in any Query call that expects a ValueExp. |
| public static ValueExp | Returns: A ValueExp object containing the argument. The returned object will be serialized as an instance of the non-public class javax.management.NumericValueExp.A long value. val)Returns a numeric value expression that can be used in any Query call that expects a ValueExp. |
| public static ValueExp | Returns: A ValueExp object containing the argument. The returned object will be serialized as an instance of the non-public class javax.management.NumericValueExp.A float value. val)Returns a numeric value expression that can be used in any Query call that expects a ValueExp. |
| public static ValueExp | Returns: A ValueExp object containing the argument. The returned object will be serialized as an instance of the non-public class javax.management.NumericValueExp.A double value. val)Returns a numeric value expression that can be used in any Query call that expects a ValueExp. |
| public static ValueExp | Returns: A ValueExp object containing the argument. The returned object will be serialized as an instance of the non-public class javax.management.BooleanValueExp.A boolean value. val)Returns a boolean value expression that can be used in any Query call that expects a ValueExp. |
| DIV | back to summary |
|---|---|
| public static final int DIV A code representing the | |
| EQ | back to summary |
|---|---|
| public static final int EQ A code representing the | |
| GE | back to summary |
|---|---|
| public static final int GE A code representing the | |
| GT | back to summary |
|---|---|
| public static final int GT A code representing the | |
| LE | back to summary |
|---|---|
| public static final int LE A code representing the | |
| LT | back to summary |
|---|---|
| public static final int LT A code representing the | |
| MINUS | back to summary |
|---|---|
| public static final int MINUS A code representing the | |
| PLUS | back to summary |
|---|---|
| public static final int PLUS A code representing the | |
| TIMES | back to summary |
|---|---|
| public static final int TIMES A code representing the | |
| Query | back to summary |
|---|---|
| public Query() Basic constructor. | |
| and | back to summary |
|---|---|
| public static QueryExp and(QueryExp q1, QueryExp q2) Returns a query expression that is the conjunction of two other query expressions.
| |
| anySubString | back to summary |
|---|---|
| public static QueryExp anySubString(AttributeValueExp a, StringValueExp s) Returns a query expression that represents a matching constraint on a string argument. The value must contain the given literal string value.
| |
| attr | back to summary |
|---|---|
| public static AttributeValueExp attr(String name) Returns a new attribute expression. See Evaluating this expression for a given
| |
| attr | back to summary |
|---|---|
| public static AttributeValueExp attr(String className, String name) Returns a new qualified attribute expression. Evaluating this expression for a given
| |
| between | back to summary |
|---|---|
| public static QueryExp between(ValueExp v1, ValueExp v2, ValueExp v3) Returns a query expression that represents the constraint that one value is between two other values.
| |
| classattr | back to summary |
|---|---|
| public static AttributeValueExp classattr() Returns a new class attribute expression which can be used in any Query call that expects a ValueExp. Evaluating this expression for a given
| |
| div | back to summary |
|---|---|
| public static ValueExp div(ValueExp value1, ValueExp value2) Returns a binary expression representing the quotient of two numeric values.
| |
| eq | back to summary |
|---|---|
| public static QueryExp eq(ValueExp v1, ValueExp v2) Returns a query expression that represents an equality constraint on two values.
| |
| escapeString | back to summary |
|---|---|
| private static String escapeString(String s) Utility method to escape strings used with Query.{initial|any|final}SubString() methods. | |
| finalSubString | back to summary |
|---|---|
| public static QueryExp finalSubString(AttributeValueExp a, StringValueExp s) Returns a query expression that represents a matching constraint on a string argument. The value must end with the given literal string value.
| |
| geq | back to summary |
|---|---|
| public static QueryExp geq(ValueExp v1, ValueExp v2) Returns a query expression that represents a "greater than or equal to" constraint on two values.
| |
| gt | back to summary |
|---|---|
| public static QueryExp gt(ValueExp v1, ValueExp v2) Returns a query expression that represents a "greater than" constraint on two values.
| |
| in | back to summary |
|---|---|
| public static QueryExp in(ValueExp val, ValueExp[] valueList) Returns an expression constraining a value to be one of an explicit list.
| |
| initialSubString | back to summary |
|---|---|
| public static QueryExp initialSubString(AttributeValueExp a, StringValueExp s) Returns a query expression that represents a matching constraint on a string argument. The value must start with the given literal string value.
| |
| isInstanceOf | back to summary |
|---|---|
| public static QueryExp isInstanceOf(StringValueExp classNameValue) Returns a query expression that represents an inheritance constraint on an MBean class. Example: to find MBeans that are instances of
Evaluating this expression for a given
| |
| leq | back to summary |
|---|---|
| public static QueryExp leq(ValueExp v1, ValueExp v2) Returns a query expression that represents a "less than or equal to" constraint on two values.
| |
| lt | back to summary |
|---|---|
| public static QueryExp lt(ValueExp v1, ValueExp v2) Returns a query expression that represents a "less than" constraint on two values.
| |
| match | back to summary |
|---|---|
| public static QueryExp match(AttributeValueExp a, StringValueExp s) Returns a query expression that represents a matching constraint on
a string argument. The matching syntax is consistent with file globbing:
supports "
| |
| minus | back to summary |
|---|---|
| public static ValueExp minus(ValueExp value1, ValueExp value2) Returns a binary expression representing the difference between two numeric values.
| |
| not | back to summary |
|---|---|
| public static QueryExp not(QueryExp queryExp) Returns a constraint that is the negation of its argument.
| |
| or | back to summary |
|---|---|
| public static QueryExp or(QueryExp q1, QueryExp q2) Returns a query expression that is the disjunction of two other query expressions.
| |
| plus | back to summary |
|---|---|
| public static ValueExp plus(ValueExp value1, ValueExp value2) Returns a binary expression representing the sum of two numeric values, or the concatenation of two string values.
| |
| times | back to summary |
|---|---|
| public static ValueExp times(ValueExp value1, ValueExp value2) Returns a binary expression representing the product of two numeric values.
| |
| value | back to summary |
|---|---|
| public static StringValueExp value(String val) Returns a new string expression.
| |
| value | back to summary |
|---|---|
| public static ValueExp value(Number val) Returns a numeric value expression that can be used in any Query call that expects a ValueExp.
| |
| value | back to summary |
|---|---|
| public static ValueExp value(int val) Returns a numeric value expression that can be used in any Query call that expects a ValueExp.
| |
| value | back to summary |
|---|---|
| public static ValueExp value(long val) Returns a numeric value expression that can be used in any Query call that expects a ValueExp.
| |
| value | back to summary |
|---|---|
| public static ValueExp value(float val) Returns a numeric value expression that can be used in any Query call that expects a ValueExp.
| |
| value | back to summary |
|---|---|
| public static ValueExp value(double val) Returns a numeric value expression that can be used in any Query call that expects a ValueExp.
| |
| value | back to summary |
|---|---|
| public static ValueExp value(boolean val) Returns a boolean value expression that can be used in any Query call that expects a ValueExp.
| |