javax.management
public class Query extends Object
MBeanServer
. By using the methods in this class,
complex queries can be created from their more basic
components.Modifier and Type | Field and Description |
---|---|
static int |
DIV
A code representing the {@link #div(ValueExp, ValueExp)
query to be used in serialization.
|
static int |
EQ
A code representing the {@link #eq(ValueExp, ValueExp)
query to be used in serialization.
|
static int |
GE
A code representing the {@link #ge(ValueExp, ValueExp)
query to be used in serialization.
|
static int |
GT
A code representing the {@link #gt(ValueExp, ValueExp)
query to be used in serialization.
|
static int |
LE
A code representing the {@link #le(ValueExp, ValueExp)
query to be used in serialization.
|
static int |
LT
A code representing the {@link #lt(ValueExp, ValueExp)
query to be used in serialization.
|
static int |
MINUS
A code representing the {@link #minus(ValueExp, ValueExp)
query to be used in serialization.
|
static int |
PLUS
A code representing the {@link #plus(ValueExp, ValueExp)
query to be used in serialization.
|
static int |
TIMES
A code representing the {@link #times(ValueExp, ValueExp)
query to be used in serialization.
|
Constructor and Description |
---|
Query() |
Modifier and Type | Method and Description |
---|---|
static QueryExp |
and(QueryExp q1,
QueryExp q2)
Returns a query expression formed from the conjunction
of the two supplied query expressions.
|
static QueryExp |
anySubString(AttributeValueExp attrib,
StringValueExp string)
Returns a query expression which checks that an
attribute value held by the specified
AttributeValueExp contains the string
specified by the given StringValueExp . |
static AttributeValueExp |
attr(String name)
Returns a value expression for the value of the
named attribute.
|
static AttributeValueExp |
attr(String className,
String name)
Returns a value expression for the value of the
named attribute from the specified class.
|
static QueryExp |
between(ValueExp v1,
ValueExp v2,
ValueExp v3)
Returns a query expression representing the constraint
that the value,
v1 , lies between v2
and v3 . |
static AttributeValueExp |
classattr()
Returns a value expression which evaluates to the name of
the class of the bean when applied.
|
static ValueExp |
div(ValueExp v1,
ValueExp v2)
Returns a value expression which evaluates to the result of
dividing
v1 by v2 . |
static QueryExp |
eq(ValueExp v1,
ValueExp v2)
Returns a query expression which evaluates to the result of
comparing
v1 to v2 for equality. |
static QueryExp |
finalSubString(AttributeValueExp attrib,
StringValueExp string)
Returns a query expression which checks that an
attribute value held by the specified
AttributeValueExp ends with the string
specified by the given StringValueExp . |
static QueryExp |
geq(ValueExp v1,
ValueExp v2)
Returns a query expression which evaluates to the result of
comparing
v1 to v2 to see if
v1 is greater than or equal to v2 . |
static QueryExp |
gt(ValueExp v1,
ValueExp v2)
Returns a query expression which evaluates to the result of
comparing
v1 to v2 to see if
v1 is greater than v2 . |
static QueryExp |
in(ValueExp v,
ValueExp[] vlist)
Returns a query expression representing the constraint
that the value,
v , is a member of the
list, vlist . |
static QueryExp |
initialSubString(AttributeValueExp attrib,
StringValueExp string)
Returns a query expression which checks that an
attribute value held by the specified
AttributeValueExp starts with the string
specified by the given StringValueExp . |
static QueryExp |
isInstanceOf(StringValueExp className)
Returns a query expression which checks that a
bean is an instance of the class specified
by the given
StringValueExp . |
static QueryExp |
leq(ValueExp v1,
ValueExp v2)
Returns a query expression which evaluates to the result of
comparing
v1 to v2 to see if
v1 is less than or equal to v2 . |
static QueryExp |
lt(ValueExp v1,
ValueExp v2)
Returns a query expression which evaluates to the result of
comparing
v1 to v2 to see if
v1 is less than v2 . |
static QueryExp |
match(AttributeValueExp attrib,
StringValueExp string)
Returns a query expression which checks that an
attribute value matches the pattern
specified by the given
StringValueExp . |
static ValueExp |
minus(ValueExp v1,
ValueExp v2)
Returns a value expression which evaluates to the result of
subtracting
v2 from v1 . |
static QueryExp |
not(QueryExp q)
Returns a query expression representing the negation
of the specified query expression.
|
static QueryExp |
or(QueryExp q1,
QueryExp q2)
Returns a query expression formed from the disjunction
of the two supplied query expressions.
|
static ValueExp |
plus(ValueExp v1,
ValueExp v2)
Returns a value expression which evaluates to the result of
adding
v1 to v2 . |
static ValueExp |
times(ValueExp v1,
ValueExp v2)
Returns a value expression which evaluates to the result of
multiplying
v1 by v2 . |
static ValueExp |
value(boolean val)
Returns a value expression wrapping the specified value.
|
static ValueExp |
value(double val)
Returns a value expression wrapping the specified value.
|
static ValueExp |
value(float val)
Returns a value expression wrapping the specified value.
|
static ValueExp |
value(int val)
Returns a value expression wrapping the specified value.
|
static ValueExp |
value(long val)
Returns a value expression wrapping the specified value.
|
static ValueExp |
value(Number val)
Returns a value expression wrapping the specified value.
|
static StringValueExp |
value(String val)
Returns a value expression wrapping the specified string.
|
public static final int PLUS
public static final int MINUS
public static final int TIMES
public static final int DIV
public static final int GT
public static final int LT
public static final int GE
public static final int LE
public static final int EQ
public Query()
public static QueryExp and(QueryExp q1, QueryExp q2)
q1
- the first query expression.q2
- the second query expression.AndQueryExp
.public static QueryExp anySubString(AttributeValueExp attrib, StringValueExp string)
AttributeValueExp
contains the string
specified by the given StringValueExp
.attrib
- the attribute to match.string
- the substring to find.attrib.matches("*" + string + "*")
.
This will be serialized as the non-public class
MatchQueryExp
.public static AttributeValueExp attr(String name)
ObjectName
involves an underlying call
to MBeanServer.getAttribute(ObjectName,String)
.name
- the name of the attribute.public static AttributeValueExp attr(String className, String name)
ObjectName
involves an underlying call
to both MBeanServer.getObjectInstance(ObjectName)
and
MBeanServer.getAttribute(ObjectName,String)
.className
- the class containing the attribute.name
- the name of the attribute.QualifiedAttributeValueExp
.public static QueryExp between(ValueExp v1, ValueExp v2, ValueExp v3)
v1
, lies between v2
and v3
.v1
- the value to compare against the boundaries.v2
- the lower boundary.v3
- the upper boundary.v1
against v2
and v3
. It returns true if
v2 <= v1 <= v3
. This
will be serialized as the non-public class
BetweenQueryExp
.public static AttributeValueExp classattr()
ObjectName
involves an underlying call
to both MBeanServer.getObjectInstance(ObjectName)
to obtain this information.ClassAttributeValueExp
.public static ValueExp div(ValueExp v1, ValueExp v2)
v1
by v2
.v1
- the left-hand operand.v2
- the right-hand operand.BinaryOpValueExp
with an operation of DIV
.public static QueryExp eq(ValueExp v1, ValueExp v2)
v1
to v2
for equality.v1
- the left-hand operand.v2
- the right-hand operand.BinaryRelQueryExp
with an operation of EQ
.public static QueryExp finalSubString(AttributeValueExp attrib, StringValueExp string)
AttributeValueExp
ends with the string
specified by the given StringValueExp
.attrib
- the attribute to match.string
- the substring to find.attrib.matches("*" + string)
.
This will be serialized as the non-public class
MatchQueryExp
.public static QueryExp geq(ValueExp v1, ValueExp v2)
v1
to v2
to see if
v1
is greater than or equal to v2
.v1
- the left-hand operand.v2
- the right-hand operand.BinaryRelQueryExp
with an operation of GE
.public static QueryExp gt(ValueExp v1, ValueExp v2)
v1
to v2
to see if
v1
is greater than v2
.v1
- the left-hand operand.v2
- the right-hand operand.BinaryRelQueryExp
with an operation of GT
.public static QueryExp in(ValueExp v, ValueExp[] vlist)
v
, is a member of the
list, vlist
.v
- the value to look for in the list.vlist
- the list of allowed values.v
against the list, vlist
.
This will be serialized as the non-public class
InQueryExp
.public static QueryExp initialSubString(AttributeValueExp attrib, StringValueExp string)
AttributeValueExp
starts with the string
specified by the given StringValueExp
.attrib
- the attribute to match.string
- the substring to find.attrib.matches(string + "*")
.
This will be serialized as the non-public class
MatchQueryExp
.public static QueryExp isInstanceOf(StringValueExp className)
StringValueExp
. Associating the
expression with an ObjectName
involves an underlying
call to MBeanServer.isInstanceOf(ObjectName, String)
using the value of ((StringValueExp)
className.apply(objectName)).getValue()
as the
class name.className
- the name of the class which the bean
should be an instance of.InstanceOfQueryExp
.public static QueryExp leq(ValueExp v1, ValueExp v2)
v1
to v2
to see if
v1
is less than or equal to v2
.v1
- the left-hand operand.v2
- the right-hand operand.BinaryRelQueryExp
with an operation of LE
.public static QueryExp lt(ValueExp v1, ValueExp v2)
v1
to v2
to see if
v1
is less than v2
.v1
- the left-hand operand.v2
- the right-hand operand.BinaryRelQueryExp
with an operation of LT
.public static QueryExp match(AttributeValueExp attrib, StringValueExp string)
Returns a query expression which checks that an
attribute value matches the pattern
specified by the given StringValueExp
.
The pattern uses file-globbing syntax:
attrib
- the attribute to match.string
- the substring to find.MatchQueryExp
.public static ValueExp minus(ValueExp v1, ValueExp v2)
v2
from v1
.v1
- the left-hand operand.v2
- the right-hand operand.BinaryOpValueExp
with an operation of MINUS
.public static QueryExp not(QueryExp q)
q
- the query to negate.q
. This will be serialized as the
non-public class NotQueryExp
.public static QueryExp or(QueryExp q1, QueryExp q2)
q1
- the first query expression.q2
- the second query expression.OrQueryExp
.public static ValueExp plus(ValueExp v1, ValueExp v2)
v1
to v2
.v1
- the left-hand operand.v2
- the right-hand operand.BinaryOpValueExp
with an operation of PLUS
.public static ValueExp times(ValueExp v1, ValueExp v2)
v1
by v2
.v1
- the left-hand operand.v2
- the right-hand operand.BinaryOpValueExp
with an operation of TIMES
.public static ValueExp value(boolean val)
val
- the boolean value to wrap.val
. This
will be serialized as the non-public class
BooleanValueExp
.public static ValueExp value(double val)
val
- the double value to wrap.val
. This
will be serialized as the non-public class
NumericValueExp
.public static ValueExp value(float val)
val
- the float value to wrap.val
. This
will be serialized as the non-public class
NumericValueExp
.public static ValueExp value(int val)
val
- the integer value to wrap.val
. This
will be serialized as the non-public class
NumericValueExp
.public static ValueExp value(long val)
val
- the long value to wrap.val
. This
will be serialized as the non-public class
NumericValueExp
.public static ValueExp value(Number val)
val
- the Number
value to wrap.val
. This
will be serialized as the non-public class
NumericValueExp
.public static StringValueExp value(String val)
val
- the String
to wrap.StringValueExp
wrapping val
.