Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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

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

All Implemented Interfaces:
  DynamicMethods

Direct Known Subclasses:
  AbstractDynamicMethodsInterceptor, DefaultDynamicMethods

    public abstract class AbstractDynamicMethods

extends Object
implements DynamicMethods

This class provides the base implementation responsible for performing dynamic method invocation such as the dynamic finders in GORM

Since:
  0.1 Created: Aug 7, 2005
Author:
  Steven Devijver, Graeme Rocher

Field Summary
`protected Class` | `clazz`
`protected Collection` | `dynamicConstructors`
`protected Collection` | `dynamicMethodInvocations`
`protected Map` | `dynamicProperties`
`protected Collection` | `staticMethodInvocations`

Constructor Summary
`AbstractDynamicMethods()` A non-registering constructor that simple creates an instance
`AbstractDynamicMethods(Class theClass)` Creates and registers a DelegatingMetaClass instance in the registry that delegates to this class
`AbstractDynamicMethods(Class theClass, boolean inRegistry)` Creates and optionally registers a DelegatingMetaClass in the MetaClasRegistry that delegates to this class

Method Summary
`void` | `addDynamicConstructor(DynamicConstructor constructor)` Adds a dynamic constructor
`void` | `addDynamicMethodInvocation(DynamicMethodInvocation methodInvocation)` Adds a new dynamic method invocation
`void` | `addDynamicProperty(DynamicProperty property)` Adds a new dynamic property
`void` | `addStaticMethodInvocation(StaticMethodInvocation methodInvocation)` Adds a new static method invocation
`DynamicMethodInvocation` | `getDynamicMethod(String method_signature)` Retrieves a dynamic method for the specified method name
`DynamicProperty` | `getDynamicProperty(String propertyName)` Retrieves a dynamic property for the specified property name
`Object` | `getProperty(Object object, String propertyName, InvocationCallback callback)` Attempts to get a dynamic property.
`Object` | `invokeConstructor(Object[] arguments, InvocationCallback callBack)` Attempts to invoke a dynamic constructor.
`Object` | `invokeMethod(Object object, String methodName, Object[] arguments, InvocationCallback callback)` Attempts to invoke a dynamic method with the specified name and arguments If successful the callback object is marked as invoked.
`Object` | `invokeStaticMethod(Object object, String methodName, Object[] arguments, InvocationCallback callBack)` Attempts to invoke a dynamic static method with the specified name and arguments If successful the callback object is marked as invoked.
`void` | `setProperty(Object object, String propertyName, Object newValue, InvocationCallback callback)` Attempts to set a dynamic property.

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

Field Detail

### dynamicMethodInvocations

    protected Collection dynamicMethodInvocations

### staticMethodInvocations

    protected Collection staticMethodInvocations

### dynamicConstructors

    protected Collection dynamicConstructors

### dynamicProperties

    protected Map dynamicProperties

### clazz

    protected Class clazz

Constructor Detail

### AbstractDynamicMethods

    public AbstractDynamicMethods(Class theClass)
                           throws IntrospectionException

  Creates and registers a DelegatingMetaClass instance in the registry that delegates to this class

  Parameters:
    `theClass` -
  Throws:
    `IntrospectionException`

### AbstractDynamicMethods

    public AbstractDynamicMethods(Class theClass,
                                  boolean inRegistry)
                           throws IntrospectionException

  Creates and optionally registers a DelegatingMetaClass in the MetaClasRegistry that delegates to this class

  Parameters:
    `theClass` -
    `inRegistry` -
  Throws:
    `IntrospectionException`

### AbstractDynamicMethods

    public AbstractDynamicMethods()

  A non-registering constructor that simple creates an instance

Method Detail

### addDynamicConstructor

    public void addDynamicConstructor(DynamicConstructor constructor)

  Description copied from interface: `DynamicMethods`
  Adds a dynamic constructor

  Specified by:
    `addDynamicConstructor` in interface `DynamicMethods`
  Parameters:
    `constructor` - The constructor to add

### addDynamicMethodInvocation

    public void addDynamicMethodInvocation(DynamicMethodInvocation methodInvocation)

  Description copied from interface: `DynamicMethods`
  Adds a new dynamic method invocation

  Specified by:
    `addDynamicMethodInvocation` in interface `DynamicMethods`

### addStaticMethodInvocation

    public void addStaticMethodInvocation(StaticMethodInvocation methodInvocation)

  Description copied from interface: `DynamicMethods`
  Adds a new static method invocation

  Specified by:
    `addStaticMethodInvocation` in interface `DynamicMethods`

### addDynamicProperty

    public void addDynamicProperty(DynamicProperty property)

  Description copied from interface: `DynamicMethods`
  Adds a new dynamic property

  Specified by:
    `addDynamicProperty` in interface `DynamicMethods`

### getProperty

    public Object getProperty(Object object,
                              String propertyName,
                              InvocationCallback callback)

  Description copied from interface: `DynamicMethods`
  Attempts to get a dynamic property. If successful the InvocationCallback instance is marked as invoked

  Specified by:
    `getProperty` in interface `DynamicMethods`
  Parameters:
    `object` - The instance
    `propertyName` - The property name to get
    `callback` - The callback object
  Returns:
    The property value if it exists

### setProperty

    public void setProperty(Object object,
                            String propertyName,
                            Object newValue,
                            InvocationCallback callback)

  Description copied from interface: `DynamicMethods`
  Attempts to set a dynamic property. If successful the InvocationCallback instance is marked as invoked

  Specified by:
    `setProperty` in interface `DynamicMethods`
  Parameters:
    `object` - The instance
    `propertyName` - The property name to set
    `callback` - The callback object

### invokeMethod

    public Object invokeMethod(Object object,
                               String methodName,
                               Object[] arguments,
                               InvocationCallback callback)

  Description copied from interface: `DynamicMethods`
  Attempts to invoke a dynamic method with the specified name and arguments If successful the callback object is marked as invoked.

  Specified by:
    `invokeMethod` in interface `DynamicMethods`
  Parameters:
    `object` - The instance to invoke on
    `methodName` - The name of the method
    `arguments` - The arguments of the method
    `callback` - The callback object
  Returns:
    The method return value

### invokeConstructor

    public Object invokeConstructor(Object[] arguments,
                                    InvocationCallback callBack)

  Description copied from interface: `DynamicMethods`
  Attempts to invoke a dynamic constructor. If successful the callback object is marked as invoked.

  Specified by:
    `invokeConstructor` in interface `DynamicMethods`
  Parameters:
    `arguments` - The arguments
    `callBack` - The callback object
  Returns:
    The constructed instance

### invokeStaticMethod

    public Object invokeStaticMethod(Object object,
                                     String methodName,
                                     Object[] arguments,
                                     InvocationCallback callBack)

  Description copied from interface: `DynamicMethods`
  Attempts to invoke a dynamic static method with the specified name and arguments If successful the callback object is marked as invoked.

  Specified by:
    `invokeStaticMethod` in interface `DynamicMethods`
  Parameters:
    `object` - The instance to invoke on
    `methodName` - The name of the method
    `arguments` - The arguments of the method
    `callBack` - The callback object
  Returns:
    The method return value

### getDynamicProperty

    public DynamicProperty getDynamicProperty(String propertyName)

  Description copied from interface: `DynamicMethods`
  Retrieves a dynamic property for the specified property name

  Specified by:
    `getDynamicProperty` in interface `DynamicMethods`
  Parameters:
    `propertyName` - The name of the property
  Returns:
    A DynamicProperty instance of null if none exists

### getDynamicMethod

    public DynamicMethodInvocation getDynamicMethod(String method_signature)

  Description copied from interface: `DynamicMethods`
  Retrieves a dynamic method for the specified method name

  Specified by:
    `getDynamicMethod` in interface `DynamicMethods`
  Parameters:
    `method_signature` - Then signature of the method
  Returns:
    The method instance or null if non exists

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 2005-2009 The Grails project