javax.management
Class Query

java.lang.Object
  |
  +--javax.management.Query

public class Query
extends java.lang.Object

Constructs query object constraints. The static methods provided return query expressions that may be used in listing and enumerating MBeans. Individual constraint construction methods allow only appropriate types as arguments. Composition of calls can construct arbitrary nestings of constraints, as the following example illustrates: QueryExp exp = Query.and(Query.gt(Query.attr("age"),Query.value(5)), Query.match(Query.attr("name"), Query.value("Smith")));

Author:
Young Yang

Field Summary
static int DIV
           
static int EQ
           
static int GE
           
static int GT
           
static int LE
           
static int LT
           
static int MINUS
           
static int PLUS
           
static int TIMES
           
 
Method Summary
static QueryExp and(QueryExp leftexp, QueryExp rightexp)
          Returns a query expression that is the conjunction of two other query expressions.
static QueryExp anySubString(AttributeValueExp attrvexp, StringValueExp strvexp)
          Returns a query expression that represents a matching constraint on a string argument.
static AttributeValueExp attr(java.lang.String name)
          Returns a new attribute expression.
static AttributeValueExp attr(java.lang.String className, java.lang.String name)
          Returns a new qualified attribute expression.
static QueryExp between(ValueExp leftvexp, ValueExp checkvexp, ValueExp rightvexp)
          Returns a query expression that represents the constraint that one value is between two other values.
static AttributeValueExp classattr()
          Returns a new class attribute expression which can be used in any Query call that expects a ValueExp.
static ValueExp div(ValueExp leftvexp, ValueExp rightvexp)
          Returns a binary expression representing the quotient of two numeric values.
static QueryExp eq(ValueExp leftvexp, ValueExp rightvexp)
          Returns a query expression that represents an equality constraint on two values.
static QueryExp finalSubString(AttributeValueExp attrvexp, StringValueExp strvexp)
          Returns a query expression that represents a matching constraint on a string argument.
static QueryExp geq(ValueExp leftvexp, ValueExp rightvexp)
          Returns a query expression that represents a "greater than or equal to" constraint on two values.
static QueryExp gt(ValueExp leftvexp, ValueExp rightvexp)
          Returns a query expression that represents a "greater than" constraint on two values.
static QueryExp in(ValueExp vexp, ValueExp[] vexps)
          Returns an expression constraining a value to be one of an explicit list.
static QueryExp initialSubString(AttributeValueExp attrvexp, StringValueExp strvexp)
          Returns a query expression that represents a matching constraint on a string argument.
static QueryExp leq(ValueExp leftvexp, ValueExp rightvexp)
          Returns a query expression that represents a "less than or equal to" constraint on two values.
static QueryExp lt(ValueExp leftvexp, ValueExp rightvexp)
          Returns a query expression that represents a "less than" constraint on two values.
static QueryExp match(AttributeValueExp attrvexp, StringValueExp strvexp)
          Returns a query expression that represents a matching constraint on a string argument.
static ValueExp minus(ValueExp leftvexp, ValueExp rightvexp)
          Returns a binary expression representing the difference between two numeric values.
static QueryExp not(QueryExp queryexp)
          Returns a constraint that is the negation of its argument.
static QueryExp or(QueryExp leftexp, QueryExp rightexp)
          Returns a query expression that is the disjunction of two other query expressions.
static ValueExp plus(ValueExp leftvexp, ValueExp rightvexp)
          Returns a binary expression representing the sum of two numeric values, or the concatenation of two string values.
static ValueExp times(ValueExp leftvexp, ValueExp rightvexp)
          Returns a binary expression representing the product of two numeric values.
static ValueExp value(boolean flag)
          Returns a boolean value expression that can be used in any Query call that expects a ValueExp.
static ValueExp value(double value)
          Returns a numeric value expression that can be used in any Query call that expects a ValueExp.
static ValueExp value(float value)
          Returns a numeric value expression that can be used in any Query call that expects a ValueExp.
static ValueExp value(int value)
          Returns a numeric value expression that can be used in any Query call that expects a ValueExp.
static ValueExp value(long value)
          Returns a numeric value expression that can be used in any Query call that expects a ValueExp.
static ValueExp value(java.lang.Number value)
          Returns a numeric value expression that can be used in any Query call that expects a ValueExp.
static StringValueExp value(java.lang.String value)
          Returns a new string expression.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GT

public static final int GT
See Also:
Constant Field Values

LT

public static final int LT
See Also:
Constant Field Values

GE

public static final int GE
See Also:
Constant Field Values

LE

public static final int LE
See Also:
Constant Field Values

EQ

public static final int EQ
See Also:
Constant Field Values

PLUS

public static final int PLUS
See Also:
Constant Field Values

MINUS

public static final int MINUS
See Also:
Constant Field Values

TIMES

public static final int TIMES
See Also:
Constant Field Values

DIV

public static final int DIV
See Also:
Constant Field Values
Method Detail

and

public static QueryExp and(QueryExp leftexp,
                           QueryExp rightexp)
Returns a query expression that is the conjunction of two other query expressions.

Parameters:
leftexp - A query expression.
rightexp - Another query expression.
Returns:
The conjunction of the two arguments.

or

public static QueryExp or(QueryExp leftexp,
                          QueryExp rightexp)
Returns a query expression that is the disjunction of two other query expressions.

Parameters:
leftexp - A query expression.
rightexp - Another query expression.
Returns:
The disjunction of the two arguments.

gt

public static QueryExp gt(ValueExp leftvexp,
                          ValueExp rightvexp)
Returns a query expression that represents a "greater than" constraint on two values.

Parameters:
leftvexp - A value expression.
rightvexp - Another value expression.
Returns:
A "greater than" constraint on the arguments.

geq

public static QueryExp geq(ValueExp leftvexp,
                           ValueExp rightvexp)
Returns a query expression that represents a "greater than or equal to" constraint on two values.

Parameters:
leftvexp - A value expression.
rightvexp - Another value expression.
Returns:
A "greater than or equal to" constraint on the arguments.

leq

public static QueryExp leq(ValueExp leftvexp,
                           ValueExp rightvexp)
Returns a query expression that represents a "less than or equal to" constraint on two values.

Parameters:
leftvexp - A value expression.
rightvexp - Another value expression.
Returns:
A "less than or equal to" constraint on the arguments.

lt

public static QueryExp lt(ValueExp leftvexp,
                          ValueExp rightvexp)
Returns a query expression that represents a "less than" constraint on two values.

Parameters:
leftvexp - A value expression.
rightvexp - Another value expression.
Returns:
A "less than" constraint on the arguments.

eq

public static QueryExp eq(ValueExp leftvexp,
                          ValueExp rightvexp)
Returns a query expression that represents an equality constraint on two values.

Parameters:
leftvexp - A value expression.
rightvexp - Another value expression.
Returns:
A "equal to" constraint on the arguments.

between

public static QueryExp between(ValueExp leftvexp,
                               ValueExp checkvexp,
                               ValueExp rightvexp)
Returns a query expression that represents the constraint that one value is between two other values.

Parameters:
leftvexp - A value expression that is "between" v2 and v3.
checkvexp - Value expression that represents a boundary of the constraint.
rightvexp - Value expression that represents a boundary of the constraint.
Returns:
The constraint that v1 lies between v2 and v3.

match

public static QueryExp match(AttributeValueExp attrvexp,
                             StringValueExp strvexp)
Returns a query expression that represents a matching constraint on a string argument. The matching syntax is consistent with file globbing: Supports "?", "*", "[", each of which may be escaped with "\"; Character classes may use "!" for negation and "-" for range. (* for any character sequence ? for a single arbitrary character [...] for a character sequence). For example: a*b?c would match a string starting with the character a, followed by any number of characters, followed by a b, any single character, and a c.

Parameters:
attrvexp - An attribute expression
strvexp - A string value expression representing a matching constraint
Returns:
A query expression that represents the matching constraint on the string argument.

attr

public static AttributeValueExp attr(java.lang.String name)
Returns a new attribute expression.

Parameters:
name - The name of the attribute.
Returns:
An attribute expression for the attribute named name.

attr

public static AttributeValueExp attr(java.lang.String className,
                                     java.lang.String name)
Returns a new qualified attribute expression.

Parameters:
className - The name of the class possessing the attribute.
name - The name of the attribute.
Returns:
An attribute expression for the attribute named name.

classattr

public static AttributeValueExp classattr()
Returns a new class attribute expression which can be used in any Query call that expects a ValueExp.

Returns:
A class attribute expression.

not

public static QueryExp not(QueryExp queryexp)
Returns a constraint that is the negation of its argument.

Parameters:
queryexp - The constraint to negate.
Returns:
A negated constraint.

in

public static QueryExp in(ValueExp vexp,
                          ValueExp[] vexps)
Returns an expression constraining a value to be one of an explicit list.

Parameters:
vexp - A value to be constrained.
vexps - An array of ValueExps.
Returns:
A QueryExp that represents the constraint.

value

public static StringValueExp value(java.lang.String value)
Returns a new string expression.

Parameters:
value - The string value.
Returns:
A ValueExp object containing the string argument.

value

public static ValueExp value(java.lang.Number value)
Returns a numeric value expression that can be used in any Query call that expects a ValueExp.

Parameters:
value - An instance of Number.
Returns:
A ValueExp object containing the argument.

value

public static ValueExp value(int value)
Returns a numeric value expression that can be used in any Query call that expects a ValueExp.

Parameters:
value - An int value.
Returns:
A ValueExp object containing the argument.

value

public static ValueExp value(long value)
Returns a numeric value expression that can be used in any Query call that expects a ValueExp.

Parameters:
value - A long value.
Returns:
A ValueExp object containing the argument.

value

public static ValueExp value(float value)
Returns a numeric value expression that can be used in any Query call that expects a ValueExp.

Parameters:
value - A float value.
Returns:
A ValueExp object containing the argument.

value

public static ValueExp value(double value)
Returns a numeric value expression that can be used in any Query call that expects a ValueExp.

Parameters:
value - A double value.
Returns:
A ValueExp object containing the argument.

value

public static ValueExp value(boolean flag)
Returns a boolean value expression that can be used in any Query call that expects a ValueExp.

Parameters:
flag - A boolean value.
Returns:
A ValueExp object containing the argument.

plus

public static ValueExp plus(ValueExp leftvexp,
                            ValueExp rightvexp)
Returns a binary expression representing the sum of two numeric values, or the concatenation of two string values.

Parameters:
leftvexp - The first '+' operand.
rightvexp - The second '+' operand.
Returns:
A ValueExp representing the sum or concatenation of the two arguments.

times

public static ValueExp times(ValueExp leftvexp,
                             ValueExp rightvexp)
Returns a binary expression representing the product of two numeric values.

Parameters:
leftvexp - The first '*' operand.
rightvexp - The second '*' operand.
Returns:
A ValueExp representing the product.

minus

public static ValueExp minus(ValueExp leftvexp,
                             ValueExp rightvexp)
Returns a binary expression representing the difference between two numeric values.

Parameters:
leftvexp - The first '-' operand.
rightvexp - The second '-' operand.
Returns:
A ValueExp representing the difference between two arguments.

div

public static ValueExp div(ValueExp leftvexp,
                           ValueExp rightvexp)
Returns a binary expression representing the quotient of two numeric values.

Parameters:
leftvexp - The first '/' operand.
rightvexp - The second '/' operand.
Returns:
A ValueExp representing the quotient of two arguments.

initialSubString

public static QueryExp initialSubString(AttributeValueExp attrvexp,
                                        StringValueExp strvexp)
Returns a query expression that represents a matching constraint on a string argument. The value must start with the given string value.

Parameters:
attrvexp - An attribute expression.
strvexp - A string value expression representing the beginning of the string value.
Returns:
The constraint that a matches s.

anySubString

public static QueryExp anySubString(AttributeValueExp attrvexp,
                                    StringValueExp strvexp)
Returns a query expression that represents a matching constraint on a string argument. The value must contain the given string value.

Parameters:
attrvexp - An attribute expression.
strvexp - A string value expression representing the substring.
Returns:
The constraint that a matches s.

finalSubString

public static QueryExp finalSubString(AttributeValueExp attrvexp,
                                      StringValueExp strvexp)
Returns a query expression that represents a matching constraint on a string argument. The value must contain the given string value.

Parameters:
attrvexp - An attribute expression.
strvexp - A string value expression representing the end of the string value.
Returns:
The constraint that a matches s.