org.codehaus.groovy.grails.orm.hibernate.metaclass
Class AbstractDynamicPersistentMethod

java.lang.Object
  extended by org.codehaus.groovy.grails.commons.metaclass.AbstractDynamicMethodInvocation
      extended by org.codehaus.groovy.grails.orm.hibernate.metaclass.AbstractDynamicPersistentMethod
All Implemented Interfaces:
DynamicMethodInvocation
Direct Known Subclasses:
AbstractSavePersistentMethod, ValidatePersistentMethod

public abstract class AbstractDynamicPersistentMethod
extends AbstractDynamicMethodInvocation

Since:
Aug 7, 2005
Author:
Steven Devijver

Field Summary
static String ERRORS_PROPERTY
           
 
Constructor Summary
AbstractDynamicPersistentMethod(Pattern pattern, org.hibernate.SessionFactory sessionFactory, ClassLoader classLoader)
           
 
Method Summary
protected abstract  Object doInvokeInternal(Object target, Object[] arguments)
           
protected  HibernateTemplate getHibernateTemplate()
           
 Object invoke(Object target, String methodName, Object[] arguments)
          Invokes the actual method.
protected  void setObjectToReadOnly(Object target)
          This method will set the target object to read-only if it is contained with the Hibernate session, Preventing Hibernate dirty-checking from persisting the instance
protected  void setObjectToReadWrite(Object target)
           
protected  Errors setupErrorsProperty(Object target)
          Initializes the Errors property on target.
 
Methods inherited from class org.codehaus.groovy.grails.commons.metaclass.AbstractDynamicMethodInvocation
getPattern, isMethodMatch, setPattern
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ERRORS_PROPERTY

public static final String ERRORS_PROPERTY
See Also:
Constant Field Values
Constructor Detail

AbstractDynamicPersistentMethod

public AbstractDynamicPersistentMethod(Pattern pattern,
                                       org.hibernate.SessionFactory sessionFactory,
                                       ClassLoader classLoader)
Method Detail

getHibernateTemplate

protected HibernateTemplate getHibernateTemplate()

invoke

public Object invoke(Object target,
                     String methodName,
                     Object[] arguments)
Description copied from interface: DynamicMethodInvocation

Invokes the actual method. The target object and arguments are supplied.

Specified by:
invoke in interface DynamicMethodInvocation
Specified by:
invoke in class AbstractDynamicMethodInvocation
Parameters:
target - the target on which the method is invoked.
arguments - the arguments passed in the method call @return the return value of the dynamic method invocation.

doInvokeInternal

protected abstract Object doInvokeInternal(Object target,
                                           Object[] arguments)

setObjectToReadOnly

protected void setObjectToReadOnly(Object target)
This method will set the target object to read-only if it is contained with the Hibernate session, Preventing Hibernate dirty-checking from persisting the instance

Parameters:
target - The target object

setObjectToReadWrite

protected void setObjectToReadWrite(Object target)

setupErrorsProperty

protected Errors setupErrorsProperty(Object target)
Initializes the Errors property on target. The target will be assigned a new Errors property. If the target contains any binding errors, those binding errors will be copied in to the new Errors property. Note that the binding errors will no longer be flagged as binding errors

Parameters:
target - object to initialize
Returns:
the new Errors object


Copyright (c) 2005-2009 The Grails project