## groovy.util
Class ProxyGenerator

    java.lang.Object
      groovy.util.ProxyGenerator

    public class ProxyGenerator

extends Object

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

Author:
  Paul King, Guillaume Laforge

Field Summary
`static ProxyGenerator` `INSTANCE`

Constructor Summary
`ProxyGenerator()`

Method Summary
`boolean` `getDebug()`
`boolean` `getEmptyMethods()`
`ClassLoader` `getOverride()`
`String` `getSimpleName(Class c)` TODO once we switch to Java 1.5 bt default, use Class#getSimpleName() directly
`Object` `instantiateAggregate(List interfaces)`
`Object` `instantiateAggregate(Map closureMap, List interfaces)`
`Object` `instantiateAggregate(Map closureMap, List interfaces, Class clazz)`
`Object` `instantiateAggregate(Map closureMap, List interfaces, Class clazz, Object[] constructorArgs)`
`Object` `instantiateAggregateFromBaseClass(Class clazz)`
`Object` `instantiateAggregateFromBaseClass(Class clazz, Object[] constructorArgs)`
`Object` `instantiateAggregateFromBaseClass(Closure cl, Class clazz)`
`Object` `instantiateAggregateFromBaseClass(Map map, Class clazz)`
`Object` `instantiateAggregateFromBaseClass(Map map, Class clazz, Object[] constructorArgs)`
`Object` `instantiateAggregateFromInterface(Class clazz)`
`Object` `instantiateAggregateFromInterface(Map map, Class clazz)`
`Object` `instantiateDelegate(List interfaces, Object delegate)`
`Object` `instantiateDelegate(Map closureMap, List interfaces, Object delegate)`
`Object` `instantiateDelegate(Object delegate)`
`Object` `instantiateDelegateWithBaseClass(Map closureMap, List interfaces, Object delegate)`
`Object` `instantiateDelegateWithBaseClass(Map closureMap, List interfaces, Object delegate, Class baseClass)`
`Object` `instantiateDelegateWithBaseClass(Map closureMap, List interfaces, Object delegate, Class baseClass, String name)`
`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(ClassLoader override)`
`String` `shortName(String name)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### INSTANCE

    public static final ProxyGenerator INSTANCE

Constructor Detail

### ProxyGenerator

    public ProxyGenerator()

Method Detail

### getDebug

    public boolean getDebug()

### 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

### getEmptyMethods

    public boolean getEmptyMethods()

### 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

### getOverride

    public ClassLoader getOverride()

### setOverride

    public void setOverride(ClassLoader override)

### instantiateAggregateFromBaseClass

    public Object instantiateAggregateFromBaseClass(Class clazz)

### instantiateAggregateFromBaseClass

    public Object instantiateAggregateFromBaseClass(Map map,
                                                    Class clazz)

### instantiateAggregateFromBaseClass

    public Object instantiateAggregateFromBaseClass(Closure cl,
                                                    Class clazz)

### instantiateAggregateFromBaseClass

    public Object instantiateAggregateFromBaseClass(Class clazz,
                                                    Object[] constructorArgs)

### instantiateAggregateFromBaseClass

    public Object instantiateAggregateFromBaseClass(Map map,
                                                    Class clazz,
                                                    Object[] constructorArgs)

### instantiateAggregateFromInterface

    public Object instantiateAggregateFromInterface(Class clazz)

### instantiateAggregateFromInterface

    public Object instantiateAggregateFromInterface(Map map,
                                                    Class clazz)

### instantiateAggregate

    public Object instantiateAggregate(List interfaces)

### instantiateAggregate

    public Object instantiateAggregate(Map closureMap,
                                       List interfaces)

### instantiateAggregate

    public Object instantiateAggregate(Map closureMap,
                                       List interfaces,
                                       Class clazz)

### instantiateAggregate

    public Object instantiateAggregate(Map closureMap,
                                       List interfaces,
                                       Class clazz,
                                       Object[] constructorArgs)

### instantiateDelegate

    public Object instantiateDelegate(Object delegate)

### instantiateDelegate

    public Object instantiateDelegate(List interfaces,
                                      Object delegate)

### instantiateDelegate

    public Object instantiateDelegate(Map closureMap,
                                      List interfaces,
                                      Object delegate)

### instantiateDelegateWithBaseClass

    public Object instantiateDelegateWithBaseClass(Map closureMap,
                                                   List interfaces,
                                                   Object delegate)

### instantiateDelegateWithBaseClass

    public Object instantiateDelegateWithBaseClass(Map closureMap,
                                                   List interfaces,
                                                   Object delegate,
                                                   Class baseClass)

### instantiateDelegateWithBaseClass

    public Object instantiateDelegateWithBaseClass(Map closureMap,
                                                   List interfaces,
                                                   Object delegate,
                                                   Class baseClass,
                                                   String name)

### getSimpleName

    public String getSimpleName(Class c)

  TODO once we switch to Java 1.5 bt default, use Class#getSimpleName() directly

  Parameters:
    `c` - the class of which we want the readable simple name
  Returns:
    the readable simple name

### shortName

    public String shortName(String name)

Copyright © 2003-2009 The Codehaus. All rights reserved.