|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object groovy.lang.GroovyObjectSupport grails.gorm.CriteriaBuilder
public class CriteriaBuilder
Criteria builder implementation that operates against Spring datastore abstraction
Field Summary | |
---|---|
static String |
AND
|
static String |
ID_EQUALS
|
static String |
IS_EMPTY
|
static String |
IS_NOT_EMPTY
|
static String |
IS_NOT_NULL
|
static String |
IS_NULL
|
static String |
NOT
|
static String |
OR
|
static String |
ORDER_ASCENDING
|
static String |
ORDER_DESCENDING
|
Constructor Summary | |
---|---|
CriteriaBuilder(Class targetClass,
Datastore datastore)
|
|
CriteriaBuilder(Class targetClass,
Datastore datastore,
Query query)
|
Method Summary | |
---|---|
Query.ProjectionList |
avg(String name)
Computes the average value of a property |
Query.Criterion |
between(String propertyName,
Object start,
Object finish)
Restricts the results by the given property value range (inclusive) |
void |
build(Closure criteria)
|
Query.ProjectionList |
count()
Count the number of records returned |
Query.Criterion |
eq(String propertyName,
Object propertyValue)
Creates an "equals" Criterion based on the specified property name and value. |
Query.Criterion |
gt(String property,
Object value)
Used to restrict a value to be greater than or equal to the given value |
Query.Criterion |
gte(String property,
Object value)
Used to restrict a value to be greater than or equal to the given value |
Query.ProjectionList |
id()
|
Query.Criterion |
in(String propertyName,
Collection values)
Creates an "in" Criterion based on the specified property name and list of values. |
Query.Criterion |
in(String propertyName,
Object[] values)
Creates an "in" Criterion based on the specified property name and list of values. |
Query.Criterion |
inList(String propertyName,
Collection values)
Creates an "in" Criterion based on the specified property name and list of values. |
Query.Criterion |
inList(String propertyName,
Object[] values)
Creates an "in" Criterion based on the specified property name and list of values. |
Object |
invokeMethod(String name,
Object obj)
|
Query.Criterion |
like(String propertyName,
Object propertyValue)
Creates an "equals" Criterion based on the specified property name and value. |
Query.Criterion |
lt(String property,
Object value)
Used to restrict a value to be less than or equal to the given value |
Query.Criterion |
lte(String property,
Object value)
Used to restrict a value to be less than or equal to the given value |
Query.ProjectionList |
max(String name)
Computes the max value of a property |
Query.ProjectionList |
min(String name)
Computes the min value of a property |
Object |
order(String propertyName)
Orders by the specified property name (defaults to ascending) |
Object |
order(String propertyName,
String direction)
Orders by the specified property name and direction |
Query.ProjectionList |
property(String name)
A projection that obtains the value of a property of an entity |
Query.ProjectionList |
rowCount()
Count the number of records returned |
Query.ProjectionList |
sum(String name)
Computes the sum of a property |
Methods inherited from class groovy.lang.GroovyObjectSupport |
---|
getMetaClass, getProperty, setMetaClass, setProperty |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String ORDER_DESCENDING
public static final String ORDER_ASCENDING
public static final String AND
public static final String NOT
public static final String OR
public static final String IS_NULL
public static final String IS_NOT_NULL
public static final String ID_EQUALS
public static final String IS_EMPTY
public static final String IS_NOT_EMPTY
Constructor Detail |
---|
public CriteriaBuilder(Class targetClass, Datastore datastore)
public CriteriaBuilder(Class targetClass, Datastore datastore, Query query)
Method Detail |
---|
public Query.ProjectionList id()
public Query.ProjectionList count()
public Query.ProjectionList rowCount()
public Query.ProjectionList property(String name)
name
- The name of the property
public Query.ProjectionList sum(String name)
name
- The name of the property
public Query.ProjectionList min(String name)
name
- The name of the property
public Query.ProjectionList max(String name)
name
- The name of the property
public Query.ProjectionList avg(String name)
name
- The name of the property
public Object invokeMethod(String name, Object obj)
invokeMethod
in interface GroovyObject
invokeMethod
in class GroovyObjectSupport
public Query.Criterion eq(String propertyName, Object propertyValue)
propertyName
- The property namepropertyValue
- The property value
public Query.Criterion between(String propertyName, Object start, Object finish)
propertyName
- The property namestart
- The start of the rangefinish
- The end of the range
public Query.Criterion gte(String property, Object value)
property
- The propertyvalue
- The value
public Query.Criterion gt(String property, Object value)
property
- The propertyvalue
- The value
public Query.Criterion lte(String property, Object value)
property
- The propertyvalue
- The value
public Query.Criterion lt(String property, Object value)
property
- The propertyvalue
- The value
public Query.Criterion like(String propertyName, Object propertyValue)
propertyName
- The property namepropertyValue
- The property value
public Query.Criterion in(String propertyName, Collection values)
propertyName
- The property namevalues
- The values
public Query.Criterion inList(String propertyName, Collection values)
propertyName
- The property namevalues
- The values
public Query.Criterion inList(String propertyName, Object[] values)
propertyName
- The property namevalues
- The values
public Query.Criterion in(String propertyName, Object[] values)
propertyName
- The property namevalues
- The values
public Object order(String propertyName)
propertyName
- The property name to order by
public Object order(String propertyName, String direction)
propertyName
- The property name to order bydirection
- Either "asc" for ascending or "desc" for descending
public void build(Closure criteria)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |