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
Interface DynamicMethods

All Known Implementing Classes:
  AbstractDynamicMethods, AbstractDynamicMethodsInterceptor, DefaultDynamicMethods, DomainClassMethods, GroovyDynamicMethodsInterceptor

    public interface DynamicMethods

An interface that defines methods for a handling dynamic method, static method and property invocations

Since:
  0.1 Created: Oct 27, 2005
Author:
  Graeme Rocher

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.

Method Detail

### addDynamicConstructor

    void addDynamicConstructor(DynamicConstructor constructor)

  Adds a dynamic constructor

  Parameters:
    `constructor` - The constructor to add

### addDynamicMethodInvocation

    void addDynamicMethodInvocation(DynamicMethodInvocation methodInvocation)

  Adds a new dynamic method invocation

  Parameters:
    `methodInvocation` -

### addStaticMethodInvocation

    void addStaticMethodInvocation(StaticMethodInvocation methodInvocation)

  Adds a new static method invocation

  Parameters:
    `methodInvocation` -

### addDynamicProperty

    void addDynamicProperty(DynamicProperty property)

  Adds a new dynamic property

  Parameters:
    `property` -

### getDynamicProperty

    DynamicProperty getDynamicProperty(String propertyName)

  Retrieves a dynamic property for the specified property name

  Parameters:
    `propertyName` - The name of the property
  Returns:
    A DynamicProperty instance of null if none exists

### getDynamicMethod

    DynamicMethodInvocation getDynamicMethod(String method_signature)

  Retrieves a dynamic method for the specified method name

  Parameters:
    `method_signature` - Then signature of the method
  Returns:
    The method instance or null if non exists

### getProperty

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

  Attempts to get a dynamic property. If successful the InvocationCallback instance is marked as invoked

  Parameters:
    `object` - The instance
    `propertyName` - The property name to get
    `callback` - The callback object
  Returns:
    The property value if it exists

### setProperty

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

  Attempts to set a dynamic property. If successful the InvocationCallback instance is marked as invoked

  Parameters:
    `object` - The instance
    `propertyName` - The property name to set
    `callback` - The callback object

### invokeMethod

    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.

  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

### invokeStaticMethod

    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.

  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

    Object invokeConstructor(Object[] arguments,
                             InvocationCallback callBack)

  Attempts to invoke a dynamic constructor. If successful the callback object is marked as invoked.

  Parameters:
    `arguments` - The arguments
    `callBack` - The callback object
  Returns:
    The constructed instance

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-2006 The Grails project