org.springframework.data.gemfire.repository.query
Class QueryString

java.lang.Object
  extended by org.springframework.data.gemfire.repository.query.QueryString

public class QueryString
extends Object

Value object to work with OQL query strings.


Constructor Summary
QueryString(Class<?> domainClass)
          Creates a SELECT query for the given domain class.
QueryString(Class<?> domainClass, boolean isCountQuery)
          Creates a SELECT query for the given domain class.
QueryString(String source)
          Creates a QueryString from the given String query.
 
Method Summary
 QueryString bindIn(Collection<?> values)
          Binds the given values to the IN parameter keyword by expanding the given values into a comma-separated String.
 QueryString forRegion(Class<?> domainClass, com.gemstone.gemfire.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(org.springframework.data.domain.Sort sort)
          Appends the Sort order to this GemFire OQL Query string.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

QueryString

public QueryString(String source)
Creates a QueryString from the given String query.

Parameters:
source - a String containing the OQL Query.

QueryString

public QueryString(Class<?> domainClass)
Creates a SELECT query for the given domain class.

Parameters:
domainClass - must not be null.

QueryString

public QueryString(Class<?> domainClass,
                   boolean isCountQuery)
Creates a SELECT query for the given domain class.

Parameters:
domainClass - must not be null.
isCountQuery - indicates if this is a count query
Method Detail

bindIn

public QueryString bindIn(Collection<?> values)
Binds the given values to the IN parameter keyword by expanding the given values into a comma-separated String.

Parameters:
values - the values to bind, returns the QueryString as is if null is given.
Returns:
a Query String having "in" parameters bound with values.

forRegion

public QueryString forRegion(Class<?> domainClass,
                             com.gemstone.gemfire.cache.Region<?,?> region)
Replaces the domain classes referenced inside the current query with the given Region.

Parameters:
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.
Returns:
a Query String with the FROM clause in the OQL statement evaluated and replaced with the fully-qualified Region to query.
See Also:
Region

getInParameterIndexes

public Iterable<Integer> getInParameterIndexes()
Returns the parameter indexes used in this query.

Returns:
the parameter indexes used in this query or an empty Iterable if none are used.
See Also:
Iterable

orderBy

public QueryString orderBy(org.springframework.data.domain.Sort sort)
Appends the Sort order to this GemFire OQL Query string.

Parameters:
sort - the Sort object indicating the order by criteria.
Returns:
this QueryString with an ORDER BY clause if the Sort object is not null, or this QueryString as-is if the Sort object is null.
See Also:
Sort, QueryString

toString

public String toString()
Overrides:
toString in class Object