## org.codehaus.groovy.grails.commons.metaclass
Class AbstractDynamicMethodsInterceptor

    java.lang.Object
      org.codehaus.groovy.grails.commons.metaclass.AbstractDynamicMethods
          org.codehaus.groovy.grails.commons.metaclass.AbstractDynamicMethodsInterceptor

All Implemented Interfaces:
  ConstructorInterceptor, DynamicMethods, Interceptor, PropertyAccessInterceptor

Direct Known Subclasses:
  GroovyDynamicMethodsInterceptor

    public abstract class AbstractDynamicMethodsInterceptor

extends AbstractDynamicMethods
implements Interceptor, PropertyAccessInterceptor, ConstructorInterceptor

Implements an the Interceptor interface to add support for using ProxyMetaClass to define dynamic methods

Since:
  Oct 24, 2005
Author:
  Graeme Rocher

Field Summary

Fields inherited from class org.codehaus.groovy.grails.commons.metaclass.AbstractDynamicMethods
`clazz, dynamicConstructors, dynamicMethodInvocations, dynamicProperties, staticMethodInvocations`

Constructor Summary
`AbstractDynamicMethodsInterceptor()`
`AbstractDynamicMethodsInterceptor(Class theClass)`
`AbstractDynamicMethodsInterceptor(Class theClass, boolean inRegistry)`

Method Summary
`Object` `afterConstructor(Object[] args, Object instantiatedInstance)` Executed after the constructor passing the args and the instantiated instance
`Object` `afterInvoke(Object object, String methodName, Object[] arguments, Object result)` This code is executed after the method is optionally called.
`Object` `beforeConstructor(Object[] args, InvocationCallback callback)` Executed before the real constructor.
`Object` `beforeGet(Object object, String property, InvocationCallback callback)` Intercepts a getXXX call and returns a result.
`Object` `beforeInvoke(Object target, String methodName, Object[] arguments, InvocationCallback callback)` This code is executed before the method is optionally called.
`void` `beforeSet(Object object, String property, Object newValue, InvocationCallback callback)` Intercepts a setXXX call

Methods inherited from class org.codehaus.groovy.grails.commons.metaclass.AbstractDynamicMethods
`addDynamicConstructor, addDynamicMethodInvocation, addDynamicProperty, addStaticMethodInvocation, getDynamicMethod, getDynamicProperty, getProperty, invokeConstructor, invokeMethod, invokeStaticMethod, setProperty`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### AbstractDynamicMethodsInterceptor

    public AbstractDynamicMethodsInterceptor()

### AbstractDynamicMethodsInterceptor

    public AbstractDynamicMethodsInterceptor(Class theClass,
                                             boolean inRegistry)
                                      throws IntrospectionException

Throws:
  `IntrospectionException`

### AbstractDynamicMethodsInterceptor

    public AbstractDynamicMethodsInterceptor(Class theClass)
                                      throws IntrospectionException

Throws:
  `IntrospectionException`

Method Detail

### afterConstructor

    public Object afterConstructor(Object[] args,
                                   Object instantiatedInstance)

  Description copied from interface: `ConstructorInterceptor`
  Executed after the constructor passing the args and the instantiated instance

  Specified by:
    `afterConstructor` in interface `ConstructorInterceptor`
  Parameters:
    `args` - The arguments
    `instantiatedInstance` - The instantiated instance
  Returns:
    The instantiated or replaced instance

### beforeConstructor

    public Object beforeConstructor(Object[] args,
                                    InvocationCallback callback)

  Description copied from interface: `ConstructorInterceptor`
  Executed before the real constructor. The callback object should be marked if invokation of the real constructor should be performed

  Specified by:
    `beforeConstructor` in interface `ConstructorInterceptor`
  Parameters:
    `args` - The constructor args
    `callback` - The callback object
  Returns:
    The instantiated object or null

### beforeInvoke

    public Object beforeInvoke(Object target,
                               String methodName,
                               Object[] arguments,
                               InvocationCallback callback)

  Description copied from interface: `Interceptor`
  This code is executed before the method is optionally called.

  Specified by:
    `beforeInvoke` in interface `Interceptor`
  Parameters:
    `target` - receiver object for the method call
    `methodName` - name of the method to call
    `arguments` - arguments to the method call
    `callback` - The callback object
  Returns:
    any arbitrary result that replaces the result of the original method call only if the callback object is marked relays this result.

### afterInvoke

    public Object afterInvoke(Object object,
                              String methodName,
                              Object[] arguments,
                              Object result)

  Description copied from interface: `Interceptor`
  This code is executed after the method is optionally called.

  Specified by:
    `afterInvoke` in interface `Interceptor`
  Parameters:
    `object` - receiver object for the called method
    `methodName` - name of the called method
    `arguments` - arguments to the called method
    `result` - result of the executed method call or result of beforeInvoke if method was not called
  Returns:
    any arbitrary result that can replace the result of the original method call. Typically, the result parameter is returned.

### beforeGet

    public Object beforeGet(Object object,
                            String property,
                            InvocationCallback callback)

  Description copied from interface: `PropertyAccessInterceptor`
  Intercepts a getXXX call and returns a result. The result is replaced by the real value if doGet() return false

  Specified by:
    `beforeGet` in interface `PropertyAccessInterceptor`
  Parameters:
    `object` - The target object
    `property` - The property to get
    `callback` - The callback object
  Returns:
    A value supplied by the interceptor

### beforeSet

    public void beforeSet(Object object,
                          String property,
                          Object newValue,
                          InvocationCallback callback)

  Description copied from interface: `PropertyAccessInterceptor`
  Intercepts a setXXX call

  Specified by:
    `beforeSet` in interface `PropertyAccessInterceptor`
  Parameters:
    `object` - The target object
    `property` - The property to set
    `newValue` - The new value
    `callback` - The callback object

Copyright (c) 2005-2009 The Grails project