public class Query extends Object
The class to build complex queries. An instance of this class is created using the statement(String, QueryMethod, Object) or
not(String, QueryMethod, Object) methods.
See the REST API documentation for information as to how to build queries. This API supports building queries in a simplified Builder pattern
Each query statement consists of the field name, query method and the object of the query. The object can be a simple primitive or a further Query object
For example:
To build a query such as name eq 'entity_name' the following code is used:
Query.statement("name", QueryMethod.EqualTo, "entity_name");
To negate this statement such as !name eq 'entity_name' the following code is used:
Query.not("name", QueryMethod.EqualTo, "entity_name");
These statements produce a QueryBuilder object. By calling the Query.QueryBuilder.build() method this creates a Query object which can then
be used in conjunction with entity or other contexts
Query objects can be chained together (and/or) by using the correct methods such as QueryBuilder#and(QueryBuilder) or
Query.QueryBuilder.orNot(String, QueryMethod, Object)
Query.QueryBuilder.build() should be called once the entire query has been built
| Modifier and Type | Class and Description |
|---|---|
static class |
Query.QueryBuilder
Object that is used to build
Query objects. |
| Modifier and Type | Field and Description |
|---|---|
protected String |
queryString |
| Modifier | Constructor and Description |
|---|---|
protected |
Query() |
| Modifier and Type | Method and Description |
|---|---|
String |
getQueryString()
Accessor method of query string
|
static Query.QueryBuilder |
not(String fieldName,
QueryMethod method,
Object fieldValue)
QueryBuilder not
|
static Query.QueryBuilder |
statement(String fieldName,
QueryMethod method,
Object fieldValue)
QueryBuilder Statement
|
String |
toString() |
protected String queryString
public static Query.QueryBuilder statement(String fieldName, QueryMethod method, Object fieldValue)
fieldName - - field namemethod - - comparison function to usefieldValue - - value to compare withpublic static Query.QueryBuilder not(String fieldName, QueryMethod method, Object fieldValue)
fieldName - - field namemethod - - comparison function to usefieldValue - - value to compare withpublic String getQueryString()
Copyright © 2021 Micro Focus. All rights reserved.