Class Query

java.lang.Object
javax.management.Query

public class Query extends Object

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")));
 
Since:
1.5