Package: org.codehaus.groovy.grails.commons.metaclass

## [Java] Interface DynamicMethods

- Defines methods for a handling dynamic method, static method and property invocations.

  Authors:
    Graeme Rocher
  Since:
    0.1

- - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `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(java.lang.String method_signature)` Retrieves a dynamic method for the specified method name.
    `DynamicProperty` | `getDynamicProperty(java.lang.String propertyName)` Retrieves a dynamic property for the specified property name.
    `java.lang.Object` | `getProperty(java.lang.Object object, java.lang.String propertyName, InvocationCallback callback)` Attempts to get a dynamic property.
    `java.lang.Object` | `invokeConstructor(java.lang.Object[] arguments, InvocationCallback callBack)` Attempts to invoke a dynamic constructor.
    `java.lang.Object` | `invokeMethod(java.lang.Object object, java.lang.String methodName, java.lang.Object[] arguments, InvocationCallback callback)` Attempts to invoke a dynamic method with the specified name and arguments.
    `java.lang.Object` | `invokeStaticMethod(java.lang.Object object, java.lang.String methodName, java.lang.Object[] arguments, InvocationCallback callBack)` Attempts to invoke a dynamic static method with the specified name and arguments.
    `void` | `setProperty(java.lang.Object object, java.lang.String propertyName, java.lang.Object newValue, InvocationCallback callback)` Attempts to set a dynamic property.

- - ### Method Detail

    - #### public void addDynamicConstructor(DynamicConstructor constructor)

      Adds a dynamic constructor.

      Parameters:
        `constructor` - The constructor to add

    - #### public void addDynamicMethodInvocation(DynamicMethodInvocation methodInvocation)

      Adds a new dynamic method invocation.

      Parameters:
        methodInvocation

    - #### public void addDynamicProperty(DynamicProperty property)

      Adds a new dynamic property.

      Parameters:
        property

    - #### public void addStaticMethodInvocation(StaticMethodInvocation methodInvocation)

      Adds a new static method invocation.

      Parameters:
        methodInvocation

    - #### public DynamicMethodInvocation getDynamicMethod(java.lang.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

    - #### public DynamicProperty getDynamicProperty(java.lang.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

    - #### public java.lang.Object getProperty(java.lang.Object object, java.lang.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

    - #### public java.lang.Object invokeConstructor(java.lang.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

    - #### public java.lang.Object invokeMethod(java.lang.Object object, java.lang.String methodName, java.lang.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

    - #### public java.lang.Object invokeStaticMethod(java.lang.Object object, java.lang.String methodName, java.lang.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

    - #### public void setProperty(java.lang.Object object, java.lang.String propertyName, java.lang.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