ProxyGenerator (Groovy 3.0.9)

Package 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.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static ProxyGenerator` | `INSTANCE` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ProxyGenerator()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `getDebug()` |
    `boolean` | `getEmptyMethods()` |
    `ClassLoader` | `getOverride()` |
    `GroovyObject` | `instantiateAggregate​(List<Class> interfaces)` |
    `GroovyObject` | `instantiateAggregate​(Map closureMap, List<Class> interfaces)` |
    `GroovyObject` | `instantiateAggregate​(Map closureMap, List<Class> interfaces, Class clazz)` |
    `GroovyObject` | `instantiateAggregate​(Map closureMap, List<Class> interfaces, Class clazz, Object[] constructorArgs)` |
    `GroovyObject` | `instantiateAggregateFromBaseClass​(Closure cl, Class clazz)` |
    `GroovyObject` | `instantiateAggregateFromBaseClass​(Class clazz)` |
    `GroovyObject` | `instantiateAggregateFromBaseClass​(Class clazz, Object[] constructorArgs)` |
    `GroovyObject` | `instantiateAggregateFromBaseClass​(Map map, Class clazz)` |
    `GroovyObject` | `instantiateAggregateFromBaseClass​(Map map, Class clazz, Object[] constructorArgs)` |
    `GroovyObject` | `instantiateAggregateFromInterface​(Class clazz)` |
    `GroovyObject` | `instantiateAggregateFromInterface​(Map map, Class clazz)` |
    `GroovyObject` | `instantiateDelegate​(Object delegate)` |
    `GroovyObject` | `instantiateDelegate​(List<Class> interfaces, Object delegate)` |
    `GroovyObject` | `instantiateDelegate​(Map closureMap, List<Class> interfaces, Object delegate)` |
    `GroovyObject` | `instantiateDelegateWithBaseClass​(Map closureMap, List<Class> interfaces, Object delegate)` |
    `GroovyObject` | `instantiateDelegateWithBaseClass​(Map closureMap, List<Class> interfaces, Object delegate, Class baseClass)` |
    `GroovyObject` | `instantiateDelegateWithBaseClass​(Map closureMap, List<Class> interfaces, Object delegate, Class baseClass, 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​(ClassLoader override)` |

    - ### 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 GroovyObject instantiateAggregateFromBaseClass​(Class clazz)

    - #### instantiateAggregateFromBaseClass

          public GroovyObject instantiateAggregateFromBaseClass​(Map map,
                                                                Class clazz)

    - #### instantiateAggregateFromBaseClass

          public GroovyObject instantiateAggregateFromBaseClass​(Closure cl,
                                                                Class clazz)

    - #### instantiateAggregateFromBaseClass

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

    - #### instantiateAggregateFromBaseClass

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

    - #### instantiateAggregateFromInterface

          public GroovyObject instantiateAggregateFromInterface​(Class clazz)

    - #### instantiateAggregateFromInterface

          public GroovyObject instantiateAggregateFromInterface​(Map map,
                                                                Class clazz)

    - #### instantiateAggregate

          public GroovyObject instantiateAggregate​(List<Class> interfaces)

    - #### instantiateAggregate

          public GroovyObject instantiateAggregate​(Map closureMap,
                                                   List<Class> interfaces)

    - #### instantiateAggregate

          public GroovyObject instantiateAggregate​(Map closureMap,
                                                   List<Class> interfaces,
                                                   Class clazz)

    - #### instantiateAggregate

          public GroovyObject instantiateAggregate​(Map closureMap,
                                                   List<Class> interfaces,
                                                   Class clazz,
                                                   Object[] constructorArgs)

    - #### instantiateDelegate

          public GroovyObject instantiateDelegate​(Object delegate)

    - #### instantiateDelegate

          public GroovyObject instantiateDelegate​(List<Class> interfaces,
                                                  Object delegate)

    - #### instantiateDelegate

          public GroovyObject instantiateDelegate​(Map closureMap,
                                                  List<Class> interfaces,
                                                  Object delegate)

    - #### instantiateDelegateWithBaseClass

          public GroovyObject instantiateDelegateWithBaseClass​(Map closureMap,
                                                               List<Class> interfaces,
                                                               Object delegate)

    - #### instantiateDelegateWithBaseClass

          public GroovyObject instantiateDelegateWithBaseClass​(Map closureMap,
                                                               List<Class> interfaces,
                                                               Object delegate,
                                                               Class baseClass)

    - #### instantiateDelegateWithBaseClass

          public GroovyObject instantiateDelegateWithBaseClass​(Map closureMap,
                                                               List<Class> interfaces,
                                                               Object delegate,
                                                               Class baseClass,
                                                               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