Query (Java 2 Platform SE 5.0) (original) (raw)
javax.management
Class Query
java.lang.Object
javax.management.Query
public class Query
extends 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")));
Since:
1.5
Field Summary | |
---|---|
static int | DIV A code representing the [div(javax.management.ValueExp, javax.management.ValueExp)](../../javax/management/Query.html#div%28javax.management.ValueExp, javax.management.ValueExp%29) expression. |
static int | EQ A code representing the [eq(javax.management.ValueExp, javax.management.ValueExp)](../../javax/management/Query.html#eq%28javax.management.ValueExp, javax.management.ValueExp%29) query. |
static int | GE A code representing the [geq(javax.management.ValueExp, javax.management.ValueExp)](../../javax/management/Query.html#geq%28javax.management.ValueExp, javax.management.ValueExp%29) query. |
static int | GT A code representing the [gt(javax.management.ValueExp, javax.management.ValueExp)](../../javax/management/Query.html#gt%28javax.management.ValueExp, javax.management.ValueExp%29) query. |
static int | LE A code representing the [leq(javax.management.ValueExp, javax.management.ValueExp)](../../javax/management/Query.html#leq%28javax.management.ValueExp, javax.management.ValueExp%29) query. |
static int | LT A code representing the [lt(javax.management.ValueExp, javax.management.ValueExp)](../../javax/management/Query.html#lt%28javax.management.ValueExp, javax.management.ValueExp%29) query. |
static int | MINUS A code representing the [minus(javax.management.ValueExp, javax.management.ValueExp)](../../javax/management/Query.html#minus%28javax.management.ValueExp, javax.management.ValueExp%29) expression. |
static int | PLUS A code representing the [plus(javax.management.ValueExp, javax.management.ValueExp)](../../javax/management/Query.html#plus%28javax.management.ValueExp, javax.management.ValueExp%29) expression. |
static int | TIMES A code representing the [times(javax.management.ValueExp, javax.management.ValueExp)](../../javax/management/Query.html#times%28javax.management.ValueExp, javax.management.ValueExp%29) expression. |
Constructor Summary |
---|
Query() Basic constructor. |
Method Summary | |
---|---|
static QueryExp | [and](../../javax/management/Query.html#and%28javax.management.QueryExp, javax.management.QueryExp%29)(QueryExp q1,QueryExp q2) Returns a query expression that is the conjunction of two other query expressions. |
static QueryExp | [anySubString](../../javax/management/Query.html#anySubString%28javax.management.AttributeValueExp, javax.management.StringValueExp%29)(AttributeValueExp a,StringValueExp s) Returns a query expression that represents a matching constraint on a string argument. |
static AttributeValueExp | attr(String name) Returns a new attribute expression. |
static AttributeValueExp | [attr](../../javax/management/Query.html#attr%28java.lang.String, java.lang.String%29)(String className,String name) Returns a new qualified attribute expression. |
static QueryExp | [between](../../javax/management/Query.html#between%28javax.management.ValueExp, javax.management.ValueExp, javax.management.ValueExp%29)(ValueExp v1,ValueExp v2,ValueExp v3) 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](../../javax/management/Query.html#div%28javax.management.ValueExp, javax.management.ValueExp%29)(ValueExp value1,ValueExp value2) Returns a binary expression representing the quotient of two numeric values. |
static QueryExp | [eq](../../javax/management/Query.html#eq%28javax.management.ValueExp, javax.management.ValueExp%29)(ValueExp v1,ValueExp v2) Returns a query expression that represents an equality constraint on two values. |
static QueryExp | [finalSubString](../../javax/management/Query.html#finalSubString%28javax.management.AttributeValueExp, javax.management.StringValueExp%29)(AttributeValueExp a,StringValueExp s) Returns a query expression that represents a matching constraint on a string argument. |
static QueryExp | [geq](../../javax/management/Query.html#geq%28javax.management.ValueExp, javax.management.ValueExp%29)(ValueExp v1,ValueExp v2) Returns a query expression that represents a "greater than or equal to" constraint on two values. |
static QueryExp | [gt](../../javax/management/Query.html#gt%28javax.management.ValueExp, javax.management.ValueExp%29)(ValueExp v1,ValueExp v2) Returns a query expression that represents a "greater than" constraint on two values. |
static QueryExp | [in](../../javax/management/Query.html#in%28javax.management.ValueExp, javax.management.ValueExp[]%29)(ValueExp val,ValueExp[] valueList) Returns an expression constraining a value to be one of an explicit list. |
static QueryExp | [initialSubString](../../javax/management/Query.html#initialSubString%28javax.management.AttributeValueExp, javax.management.StringValueExp%29)(AttributeValueExp a,StringValueExp s) Returns a query expression that represents a matching constraint on a string argument. |
static QueryExp | [leq](../../javax/management/Query.html#leq%28javax.management.ValueExp, javax.management.ValueExp%29)(ValueExp v1,ValueExp v2) Returns a query expression that represents a "less than or equal to" constraint on two values. |
static QueryExp | [lt](../../javax/management/Query.html#lt%28javax.management.ValueExp, javax.management.ValueExp%29)(ValueExp v1,ValueExp v2) Returns a query expression that represents a "less than" constraint on two values. |
static QueryExp | [match](../../javax/management/Query.html#match%28javax.management.AttributeValueExp, javax.management.StringValueExp%29)(AttributeValueExp a,StringValueExp s) Returns a query expression that represents a matching constraint on a string argument. |
static ValueExp | [minus](../../javax/management/Query.html#minus%28javax.management.ValueExp, javax.management.ValueExp%29)(ValueExp value1,ValueExp value2) 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](../../javax/management/Query.html#or%28javax.management.QueryExp, javax.management.QueryExp%29)(QueryExp q1,QueryExp q2) Returns a query expression that is the disjunction of two other query expressions. |
static ValueExp | [plus](../../javax/management/Query.html#plus%28javax.management.ValueExp, javax.management.ValueExp%29)(ValueExp value1,ValueExp value2) Returns a binary expression representing the sum of two numeric values, or the concatenation of two string values. |
static ValueExp | [times](../../javax/management/Query.html#times%28javax.management.ValueExp, javax.management.ValueExp%29)(ValueExp value1,ValueExp value2) Returns a binary expression representing the product of two numeric values. |
static ValueExp | value(boolean val) Returns a boolean value expression that can be used in any Query call that expects a ValueExp. |
static ValueExp | value(double val) Returns a numeric value expression that can be used in any Query call that expects a ValueExp. |
static ValueExp | value(float val) Returns a numeric value expression that can be used in any Query call that expects a ValueExp. |
static ValueExp | value(int val) Returns a numeric value expression that can be used in any Query call that expects a ValueExp. |
static ValueExp | value(long val) Returns a numeric value expression that can be used in any Query call that expects a ValueExp. |
static ValueExp | value(Number val) Returns a numeric value expression that can be used in any Query call that expects a ValueExp. |
static StringValueExp | value(String val) Returns a new string expression. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, [wait](../../java/lang/Object.html#wait%28long, int%29) |
Field Detail |
---|
GT
public static final int GT
A code representing the [gt(javax.management.ValueExp, javax.management.ValueExp)](../../javax/management/Query.html#gt%28javax.management.ValueExp, javax.management.ValueExp%29) query. This is chiefly of interest for the serialized form of queries.
See Also:
LT
public static final int LT
A code representing the [lt(javax.management.ValueExp, javax.management.ValueExp)](../../javax/management/Query.html#lt%28javax.management.ValueExp, javax.management.ValueExp%29) query. This is chiefly of interest for the serialized form of queries.
See Also:
GE
public static final int GE
A code representing the [geq(javax.management.ValueExp, javax.management.ValueExp)](../../javax/management/Query.html#geq%28javax.management.ValueExp, javax.management.ValueExp%29) query. This is chiefly of interest for the serialized form of queries.
See Also:
LE
public static final int LE
A code representing the [leq(javax.management.ValueExp, javax.management.ValueExp)](../../javax/management/Query.html#leq%28javax.management.ValueExp, javax.management.ValueExp%29) query. This is chiefly of interest for the serialized form of queries.
See Also:
EQ
public static final int EQ
A code representing the [eq(javax.management.ValueExp, javax.management.ValueExp)](../../javax/management/Query.html#eq%28javax.management.ValueExp, javax.management.ValueExp%29) query. This is chiefly of interest for the serialized form of queries.
See Also:
PLUS
public static final int PLUS
A code representing the [plus(javax.management.ValueExp, javax.management.ValueExp)](../../javax/management/Query.html#plus%28javax.management.ValueExp, javax.management.ValueExp%29) expression. This is chiefly of interest for the serialized form of queries.
See Also:
MINUS
public static final int MINUS
A code representing the [minus(javax.management.ValueExp, javax.management.ValueExp)](../../javax/management/Query.html#minus%28javax.management.ValueExp, javax.management.ValueExp%29) expression. This is chiefly of interest for the serialized form of queries.
See Also:
TIMES
public static final int TIMES
A code representing the [times(javax.management.ValueExp, javax.management.ValueExp)](../../javax/management/Query.html#times%28javax.management.ValueExp, javax.management.ValueExp%29) expression. This is chiefly of interest for the serialized form of queries.
See Also:
DIV
public static final int DIV
A code representing the [div(javax.management.ValueExp, javax.management.ValueExp)](../../javax/management/Query.html#div%28javax.management.ValueExp, javax.management.ValueExp%29) expression. This is chiefly of interest for the serialized form of queries.
See Also:
Constructor Detail |
---|
Query
public Query()
Basic constructor.
Method Detail |
---|
and
public static QueryExp and(QueryExp q1, QueryExp q2)
Returns a query expression that is the conjunction of two other query expressions.
Parameters:
q1
- A query expression.
q2
- Another query expression.
Returns:
The conjunction of the two arguments.
or
public static QueryExp or(QueryExp q1, QueryExp q2)
Returns a query expression that is the disjunction of two other query expressions.
Parameters:
q1
- A query expression.
q2
- Another query expression.
Returns:
The disjunction of the two arguments.
gt
public static QueryExp gt(ValueExp v1, ValueExp v2)
Returns a query expression that represents a "greater than" constraint on two values.
Parameters:
v1
- A value expression.
v2
- Another value expression.
Returns:
A "greater than" constraint on the arguments.
geq
public static QueryExp geq(ValueExp v1, ValueExp v2)
Returns a query expression that represents a "greater than or equal to" constraint on two values.
Parameters:
v1
- A value expression.
v2
- Another value expression.
Returns:
A "greater than or equal to" constraint on the arguments.
leq
public static QueryExp leq(ValueExp v1, ValueExp v2)
Returns a query expression that represents a "less than or equal to" constraint on two values.
Parameters:
v1
- A value expression.
v2
- Another value expression.
Returns:
A "less than or equal to" constraint on the arguments.
lt
public static QueryExp lt(ValueExp v1, ValueExp v2)
Returns a query expression that represents a "less than" constraint on two values.
Parameters:
v1
- A value expression.
v2
- Another value expression.
Returns:
A "less than" constraint on the arguments.
eq
public static QueryExp eq(ValueExp v1, ValueExp v2)
Returns a query expression that represents an equality constraint on two values.
Parameters:
v1
- A value expression.
v2
- Another value expression.
Returns:
A "equal to" constraint on the arguments.
between
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.
Parameters:
v1
- A value expression that is "between" v2 and v3.
v2
- Value expression that represents a boundary of the constraint.
v3
- 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 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 "?
", "*
", "[
", 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:
a
- An attribute expression
s
- 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(String name)
Returns a new attribute expression.
Evaluating this expression for a givenobjectName
includes performing [MBeanServer.getAttribute(objectName, name)](../../javax/management/MBeanServer.html#getAttribute%28javax.management.ObjectName, java.lang.String%29).
Parameters:
name
- The name of the attribute.
Returns:
An attribute expression for the attribute named name.
attr
public static AttributeValueExp attr(String className, String name)
Returns a new qualified attribute expression.
Evaluating this expression for a givenobjectName
includes performing MBeanServer.getObjectInstance(objectName) and [MBeanServer.getAttribute(objectName, name)](../../javax/management/MBeanServer.html#getAttribute%28javax.management.ObjectName, java.lang.String%29).
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.
Evaluating this expression for a givenobjectName
includes performing MBeanServer.getObjectInstance(objectName).
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 val, ValueExp[] valueList)
Returns an expression constraining a value to be one of an explicit list.
Parameters:
val
- A value to be constrained.
valueList
- An array of ValueExps.
Returns:
A QueryExp that represents the constraint.
value
public static StringValueExp value(String val)
Returns a new string expression.
Parameters:
val
- The string value.
Returns:
A ValueExp object containing the string argument.
value
public static ValueExp value(Number val)
Returns a numeric value expression that can be used in any Query call that expects a ValueExp.
Parameters:
val
- An instance of Number.
Returns:
A ValueExp object containing the argument.
value
public static ValueExp value(int val)
Returns a numeric value expression that can be used in any Query call that expects a ValueExp.
Parameters:
val
- An int value.
Returns:
A ValueExp object containing the argument.
value
public static ValueExp value(long val)
Returns a numeric value expression that can be used in any Query call that expects a ValueExp.
Parameters:
val
- A long value.
Returns:
A ValueExp object containing the argument.
value
public static ValueExp value(float val)
Returns a numeric value expression that can be used in any Query call that expects a ValueExp.
Parameters:
val
- A float value.
Returns:
A ValueExp object containing the argument.
value
public static ValueExp value(double val)
Returns a numeric value expression that can be used in any Query call that expects a ValueExp.
Parameters:
val
- A double value.
Returns:
A ValueExp object containing the argument.
value
public static ValueExp value(boolean val)
Returns a boolean value expression that can be used in any Query call that expects a ValueExp.
Parameters:
val
- A boolean value.
Returns:
A ValueExp object containing the argument.
plus
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.
Parameters:
value1
- The first '+' operand.
value2
- The second '+' operand.
Returns:
A ValueExp representing the sum or concatenation of the two arguments.
times
public static ValueExp times(ValueExp value1, ValueExp value2)
Returns a binary expression representing the product of two numeric values.
Parameters:
value1
- The first '*' operand.
value2
- The second '*' operand.
Returns:
A ValueExp representing the product.
minus
public static ValueExp minus(ValueExp value1, ValueExp value2)
Returns a binary expression representing the difference between two numeric values.
Parameters:
value1
- The first '-' operand.
value2
- The second '-' operand.
Returns:
A ValueExp representing the difference between two arguments.
div
public static ValueExp div(ValueExp value1, ValueExp value2)
Returns a binary expression representing the quotient of two numeric values.
Parameters:
value1
- The first '/' operand.
value2
- The second '/' operand.
Returns:
A ValueExp representing the quotient of two arguments.
initialSubString
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 string value.
Parameters:
a
- An attribute expression.
s
- A string value expression representing the beginning of the string value.
Returns:
The constraint that a matches s.
anySubString
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 string value.
Parameters:
a
- An attribute expression.
s
- A string value expression representing the substring.
Returns:
The constraint that a matches s.
finalSubString
public static QueryExp finalSubString(AttributeValueExp a, StringValueExp s)
Returns a query expression that represents a matching constraint on a string argument. The value must contain the given string value.
Parameters:
a
- An attribute expression.
s
- A string value expression representing the end of the string value.
Returns:
The constraint that a matches s.
Submit a bug or feature
For further API reference and developer documentation, see Java 2 SDK SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 2004, 2010 Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.