Package: groovy.util

## [Java] Class Proxy

- groovy.util.Proxy

-     public class Proxy
      extends GroovyObjectSupport

  Dynamic groovy proxy for another object. All method invocations get forwarded to actual object, unless the proxy overrides it. See groovy/util/ProxyTest.groovy for usage details.

- - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public Object` | `getAdaptee()` Returns the wrapped adaptee.
    `` | `public Object` | `invokeMethod(String name, Object args)` Invokes a proxy method or forwards the call to the adaptee.
    `` | `public Iterator` | `iterator()` Returns an iterator over the adaptee.
    `` | `public void` | `setAdaptee(Object adaptee)` Sets the wrapped adaptee.
    `` | `public Proxy` | `wrap(Object adaptee)` This method is for convenience.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class GroovyObjectSupport` | `getMetaClass, setMetaClass`

- - ### Method Detail

    - #### public Object getAdaptee()

      Returns the wrapped adaptee.

      Returns:
        the adaptee

    - #### public Object invokeMethod(String name, Object args)

      Invokes a proxy method or forwards the call to the adaptee.

      Parameters:
        `name` - the method name
        `args` - the invocation arguments
      Returns:
        the invocation result

    - #### public Iterator iterator()

      Returns an iterator over the adaptee.

      Returns:
        an iterator for the adaptee

    - #### public void setAdaptee(Object adaptee)

      Sets the wrapped adaptee.

      Parameters:
        `adaptee` - the adaptee to wrap

    - #### public Proxy wrap(Object adaptee)

      This method is for convenience. It allows to get around the need for defining dump ctors in subclasses. See unit tests for details.