public class QueryString extends Object
QueryString is a utility class used to construct GemFire OQL query statement syntax.Pattern,
Sort,
OqlKeyword,
Region| Modifier and Type | Field and Description |
|---|---|
protected static Pattern |
HINT_PATTERN |
protected static Pattern |
IMPORT_PATTERN |
protected static Pattern |
LIMIT_PATTERN |
protected static Pattern |
TRACE_PATTERN |
| Constructor and Description |
|---|
QueryString(Class<?> domainType)
Constructs a GemFire OQL SELECT Query for the given domain class.
|
QueryString(Class<?> domainType,
boolean isCountQuery)
Constructs a GemFire OQL SELECT Query for the given domain class.
|
QueryString(String query)
Constructs an instance of
QueryString initialized with the given GemFire OQL Query String. |
| Modifier and Type | Method and Description |
|---|---|
QueryString |
bindIn(Collection<?> values)
Binds the given
Collection of values into the IN parameters of the OQL Query by expanding
the given values into a comma-separated String. |
QueryString |
forRegion(Class<?> domainClass,
org.apache.geode.cache.Region<?,?> region)
Replaces the domain classes referenced inside the current query with the given
Region. |
Iterable<Integer> |
getInParameterIndexes()
Returns the parameter indexes used in this query.
|
QueryString |
orderBy(Sort sort)
Appends the
Sort order to this GemFire OQL Query string. |
String |
toString() |
QueryString |
withHints(String... hints)
Applies HINTS to the OQL Query.
|
QueryString |
withImport(String importExpression)
Applies an IMPORT to the OQL Query.
|
QueryString |
withLimit(Integer limit)
Applies a LIMIT to the OQL Query.
|
QueryString |
withTrace()
Applies TRACE logging to the OQL Query.
|
protected static final Pattern HINT_PATTERN
protected static final Pattern IMPORT_PATTERN
protected static final Pattern LIMIT_PATTERN
protected static final Pattern TRACE_PATTERN
public QueryString(String query)
QueryString initialized with the given GemFire OQL Query String.query - String specifying the GemFire OQL Query.IllegalArgumentException - if the query string is unspecified (null or empty).public QueryString(Class<?> domainType)
domainType - application domain object type to query; must not be null.QueryString(Class, boolean)public QueryString(Class<?> domainType, boolean isCountQuery)
isCountQuery indicates
whether to select a count or select the contents of the objects of the given domain object type.domainType - application domain object type to query; must not be null.isCountQuery - boolean value to indicate if this is a count query.IllegalArgumentException - if domainType is null.QueryString(String)public QueryString bindIn(Collection<?> values)
Collection of values into the IN parameters of the OQL Query by expanding
the given values into a comma-separated String.values - the values to bind, returns the QueryString as is if null is given.public QueryString forRegion(Class<?> domainClass, org.apache.geode.cache.Region<?,?> region)
Region.domainClass - the class type of the GemFire persistent entity to query; must not be null.region - the GemFire Region in which to query; must not be null.Regionpublic Iterable<Integer> getInParameterIndexes()
public QueryString orderBy(Sort sort)
Sort order to this GemFire OQL Query string.sort - Sort indicating the order of the query results.QueryString with an ORDER BY clause if Sort is not null,
or this QueryString as-is if Sort is null.Sort,
QueryStringpublic QueryString withHints(String... hints)
hints - array of Strings containing query hints.QueryString if hints are not null or empty, or return this QueryString.public QueryString withImport(String importExpression)
importExpression - String containing the import clause.QueryString if an import was declared, or return this QueryString.public QueryString withLimit(Integer limit)
limit - Integer indicating the number of results to return from the query.QueryString if a limit was specified, or return this QueryString.public QueryString withTrace()
QueryString with tracing enabled.Copyright © 2011–2017 Pivotal Software, Inc.. All rights reserved.