org.grails.datastore.gorm.finders
Class DynamicFinder

java.lang.Object
  extended by org.grails.datastore.gorm.finders.DynamicFinder
All Implemented Interfaces:
FinderMethod
Direct Known Subclasses:
CountByFinder, FindAllByFinder, FindByFinder

public abstract class DynamicFinder
extends Object
implements FinderMethod

Implementation of dynamic finders


Field Summary
static String ARGUMENT_CACHE
           
static String ARGUMENT_FETCH
           
static String ARGUMENT_IGNORE_CASE
           
static String ARGUMENT_LOCK
           
static String ARGUMENT_MAX
           
static String ARGUMENT_OFFSET
           
static String ARGUMENT_ORDER
           
static String ARGUMENT_SORT
           
static String ORDER_ASC
           
static String ORDER_DESC
           
protected  Pattern pattern
           
 
Constructor Summary
DynamicFinder(Pattern pattern, String[] operators)
           
 
Method Summary
protected  void applyAdditionalCriteria(Query query, Closure additionalCriteria)
           
protected  void configureQueryWithArguments(Class clazz, Query query, Object[] arguments)
           
protected abstract  Object doInvokeInternalWithExpressions(Class clazz, String methodName, Object[] remainingArguments, List<MethodExpression> expressions, Closure additionalCriteria, String operatorInUse)
           
 Object invoke(Class clazz, String methodName, Closure additionalCriteria, Object[] arguments)
           
 Object invoke(Class clazz, String methodName, Object[] arguments)
          Invokes the method
 boolean isMethodMatch(String methodName)
          Whether the given method name matches this finder
static void populateArgumentsForCriteria(Class<?> targetClass, Query q, Map argMap)
           
 void setPattern(String pattern)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ARGUMENT_MAX

public static final String ARGUMENT_MAX
See Also:
Constant Field Values

ARGUMENT_OFFSET

public static final String ARGUMENT_OFFSET
See Also:
Constant Field Values

ARGUMENT_ORDER

public static final String ARGUMENT_ORDER
See Also:
Constant Field Values

ARGUMENT_SORT

public static final String ARGUMENT_SORT
See Also:
Constant Field Values

ORDER_DESC

public static final String ORDER_DESC
See Also:
Constant Field Values

ORDER_ASC

public static final String ORDER_ASC
See Also:
Constant Field Values

ARGUMENT_FETCH

public static final String ARGUMENT_FETCH
See Also:
Constant Field Values

ARGUMENT_IGNORE_CASE

public static final String ARGUMENT_IGNORE_CASE
See Also:
Constant Field Values

ARGUMENT_CACHE

public static final String ARGUMENT_CACHE
See Also:
Constant Field Values

ARGUMENT_LOCK

public static final String ARGUMENT_LOCK
See Also:
Constant Field Values

pattern

protected Pattern pattern
Constructor Detail

DynamicFinder

public DynamicFinder(Pattern pattern,
                     String[] operators)
Method Detail

setPattern

public void setPattern(String pattern)
Specified by:
setPattern in interface FinderMethod
Parameters:
pattern - A regular expression

isMethodMatch

public boolean isMethodMatch(String methodName)
Description copied from interface: FinderMethod
Whether the given method name matches this finder

Specified by:
isMethodMatch in interface FinderMethod
Parameters:
methodName - The method name
Returns:
true if it does

invoke

public Object invoke(Class clazz,
                     String methodName,
                     Closure additionalCriteria,
                     Object[] arguments)

invoke

public Object invoke(Class clazz,
                     String methodName,
                     Object[] arguments)
Description copied from interface: FinderMethod
Invokes the method

Specified by:
invoke in interface FinderMethod
Parameters:
clazz - The class
methodName - The method name
arguments - The arguments
Returns:
The return value

doInvokeInternalWithExpressions

protected abstract Object doInvokeInternalWithExpressions(Class clazz,
                                                          String methodName,
                                                          Object[] remainingArguments,
                                                          List<MethodExpression> expressions,
                                                          Closure additionalCriteria,
                                                          String operatorInUse)

populateArgumentsForCriteria

public static void populateArgumentsForCriteria(Class<?> targetClass,
                                                Query q,
                                                Map argMap)

configureQueryWithArguments

protected void configureQueryWithArguments(Class clazz,
                                           Query query,
                                           Object[] arguments)

applyAdditionalCriteria

protected void applyAdditionalCriteria(Query query,
                                       Closure additionalCriteria)