groovy.util

## Class Proxy

- java.lang.Object
- - groovy.lang.GroovyObjectSupport
  - - groovy.util.Proxy

All Implemented Interfaces:
  GroovyObject

    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.

Author:
  Troy Heninger, Dierk Koenig

### Constructor Summary

Constructors
Constructor and Description
`Proxy()`

### Method Summary

All Methods Instance Methods Concrete Methods
`java.lang.Object` `getAdaptee()`
`java.lang.Object` `invokeMethod(java.lang.String name, java.lang.Object args)` Invokes the given method.
`java.util.Iterator` `iterator()`
`void` `setAdaptee(java.lang.Object adaptee)`
`Proxy` `wrap(java.lang.Object adaptee)` This method is for convenience.

### Methods inherited from class groovy.lang.GroovyObjectSupport

`getMetaClass, getProperty, setMetaClass, setProperty`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### Proxy

    public Proxy()

### Method Detail

#### wrap

    public Proxy wrap(java.lang.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.

#### getAdaptee

    public java.lang.Object getAdaptee()

#### setAdaptee

    public void setAdaptee(java.lang.Object adaptee)

#### invokeMethod

    public java.lang.Object invokeMethod(java.lang.String name,
                                         java.lang.Object args)

Description copied from interface: `GroovyObject`
Invokes the given method.

Specified by:
  `invokeMethod` in interface `GroovyObject`
Overrides:
  `invokeMethod` in class `GroovyObjectSupport`
Parameters:
  `name` - the name of the method to call
  `args` - the arguments to use for the method call
Returns:
  the result of invoking the method

#### iterator

    public java.util.Iterator iterator()