Groovy Documentation

## groovy.util
[Java] Class ProxyGenerator

    java.lang.Object
      groovy.util.ProxyGenerator

    public class ProxyGenerator
    extends java.lang.Object

Classes to generate 'Proxy' objects which implement interfaces, maps of closures and/or extend classes/delegates.

Authors:
  Paul King
  Guillaume Laforge
  Cedric Champeau

Field Summary
`static ProxyGenerator` | `INSTANCE`

Method Summary
`boolean` | `getDebug()`
`boolean` | `getEmptyMethods()`
`java.lang.ClassLoader` | `getOverride()`
`GroovyObject` | `instantiateAggregate(java.util.List interfaces)`
`GroovyObject` | `instantiateAggregate(java.util.Map closureMap, java.util.List interfaces)`
`GroovyObject` | `instantiateAggregate(java.util.Map closureMap, java.util.List interfaces, java.lang.Class clazz)`
`GroovyObject` | `instantiateAggregate(java.util.Map closureMap, java.util.List interfaces, java.lang.Class clazz, java.lang.Object[] constructorArgs)`
`GroovyObject` | `instantiateAggregateFromBaseClass(java.lang.Class clazz)`
`GroovyObject` | `instantiateAggregateFromBaseClass(java.util.Map map, java.lang.Class clazz)`
`GroovyObject` | `instantiateAggregateFromBaseClass(Closure cl, java.lang.Class clazz)`
`GroovyObject` | `instantiateAggregateFromBaseClass(java.lang.Class clazz, java.lang.Object[] constructorArgs)`
`GroovyObject` | `instantiateAggregateFromBaseClass(java.util.Map map, java.lang.Class clazz, java.lang.Object[] constructorArgs)`
`GroovyObject` | `instantiateAggregateFromInterface(java.lang.Class clazz)`
`GroovyObject` | `instantiateAggregateFromInterface(java.util.Map map, java.lang.Class clazz)`
`GroovyObject` | `instantiateDelegate(java.lang.Object delegate)`
`GroovyObject` | `instantiateDelegate(java.util.List interfaces, java.lang.Object delegate)`
`GroovyObject` | `instantiateDelegate(java.util.Map closureMap, java.util.List interfaces, java.lang.Object delegate)`
`GroovyObject` | `instantiateDelegateWithBaseClass(java.util.Map closureMap, java.util.List interfaces, java.lang.Object delegate)`
`GroovyObject` | `instantiateDelegateWithBaseClass(java.util.Map closureMap, java.util.List interfaces, java.lang.Object delegate, java.lang.Class baseClass)`
`GroovyObject` | `instantiateDelegateWithBaseClass(java.util.Map closureMap, java.util.List interfaces, java.lang.Object delegate, java.lang.Class baseClass, java.lang.String name)` Creates a proxy with a delegate object.
`void` | `setDebug(boolean debug)` Instructs `ProxyGenerator` to dump generated Groovy source code to standard output during construction.
`void` | `setEmptyMethods(boolean emptyMethods)` Changes generated methods to have empty implementations.
`void` | `setOverride(java.lang.ClassLoader override)`

Methods inherited from class java.lang.Object
java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()

Field Detail

### INSTANCE

    public static final ProxyGenerator INSTANCE

Method Detail

### getDebug

    public boolean getDebug()

### getEmptyMethods

    public boolean getEmptyMethods()

### getOverride

    public java.lang.ClassLoader getOverride()

### instantiateAggregate

    public GroovyObject instantiateAggregate(java.util.List interfaces)

### instantiateAggregate

    public GroovyObject instantiateAggregate(java.util.Map closureMap, java.util.List interfaces)

### instantiateAggregate

    public GroovyObject instantiateAggregate(java.util.Map closureMap, java.util.List interfaces, java.lang.Class clazz)

### instantiateAggregate

    public GroovyObject instantiateAggregate(Map closureMap, List<Class> interfaces, Class clazz, Object[] constructorArgs) {
    public GroovyObject instantiateAggregate(java.util.Map closureMap, java.util.List interfaces, java.lang.Class clazz, java.lang.Object[] constructorArgs)

### instantiateAggregateFromBaseClass

    public GroovyObject instantiateAggregateFromBaseClass(java.lang.Class clazz)

### instantiateAggregateFromBaseClass

    public GroovyObject instantiateAggregateFromBaseClass(java.util.Map map, java.lang.Class clazz)

### instantiateAggregateFromBaseClass

    public GroovyObject instantiateAggregateFromBaseClass(Closure cl, java.lang.Class clazz)

### instantiateAggregateFromBaseClass

    public GroovyObject instantiateAggregateFromBaseClass(java.lang.Class clazz, java.lang.Object[] constructorArgs)

### instantiateAggregateFromBaseClass

    public GroovyObject instantiateAggregateFromBaseClass(java.util.Map map, java.lang.Class clazz, java.lang.Object[] constructorArgs)

### instantiateAggregateFromInterface

    public GroovyObject instantiateAggregateFromInterface(java.lang.Class clazz)

### instantiateAggregateFromInterface

    public GroovyObject instantiateAggregateFromInterface(java.util.Map map, java.lang.Class clazz)

### instantiateDelegate

    public GroovyObject instantiateDelegate(java.lang.Object delegate)

### instantiateDelegate

    public GroovyObject instantiateDelegate(java.util.List interfaces, java.lang.Object delegate)

### instantiateDelegate

    public GroovyObject instantiateDelegate(java.util.Map closureMap, java.util.List interfaces, java.lang.Object delegate)

### instantiateDelegateWithBaseClass

    public GroovyObject instantiateDelegateWithBaseClass(java.util.Map closureMap, java.util.List interfaces, java.lang.Object delegate)

### instantiateDelegateWithBaseClass

    public GroovyObject instantiateDelegateWithBaseClass(java.util.Map closureMap, java.util.List interfaces, java.lang.Object delegate, java.lang.Class baseClass)

### instantiateDelegateWithBaseClass

    public GroovyObject instantiateDelegateWithBaseClass(Map closureMap, List<Class> interfaces, Object delegate, Class baseClass, String name) {
    public GroovyObject instantiateDelegateWithBaseClass(java.util.Map closureMap, java.util.List interfaces, java.lang.Object delegate, java.lang.Class baseClass, java.lang.String name)

  Creates a proxy with a delegate object.
  Parameters:
    `closureMap` - the closure for methods not handled by the delegate
    `interfaces` - interfaces to be implemented
    `delegate` - the delegate object
    `baseClass` - the base class
    `name` - the name of the proxy, unused, but kept for compatibility with previous versions of Groovy.
  Returns:
    a proxy object implementing the specified interfaces, and delegating to the provided object

### setDebug

    public void setDebug(boolean debug)

  Instructs `ProxyGenerator` to dump generated Groovy source code to standard output during construction. This is useful for debugging purposes but should be turned off in production.
  Parameters:
    `debug` - true if you want generated source to be printed

### setEmptyMethods

    public void setEmptyMethods(boolean emptyMethods)

  Changes generated methods to have empty implementations.

  Methods in generated aggregates not supplied in a closures map or base class are given 'default' implementations. The implementation will normally throw an `UnsupportedOperationException` but setting this boolean will leave it empty.
  Parameters:
    `emptyMethods` - true if you want generated methods to be empty

### setOverride

    public void setOverride(java.lang.ClassLoader override)

Groovy Documentation