Package: groovy.lang

## [Java] Class GroovyClassLoader.ClassCollector

- groovy.lang.GroovyClassLoader.ClassCollector

- All Implemented Interfaces and Traits:
    CompilationUnitClassgenCallback

      public static class GroovyClassLoader.ClassCollector
      extends Object
      implements CompilationUnitClassgenCallback

  Collects classes defined during a compilation unit callback.

- - ### Constructor Summary

    Constructors
    Constructor and description
    `protected ClassCollector(GroovyClassLoader.InnerLoader cl, CompilationUnit unit, SourceUnit su)` Creates a class collector for the supplied compilation state.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public void` | `call(org.objectweb.asm.ClassVisitor classWriter, ClassNode classNode)`
    `` | `protected Class` | `createClass(byte[] code, ClassNode classNode)` Defines a generated class from bytecode produced for a class node.
    `` | `public GroovyClassLoader` | `getDefiningClassLoader()` Returns the loader used to define generated classes.
    `` | `public Collection` | `getLoadedClasses()` Returns the classes defined during the current compilation callback.
    `` | `protected Class` | `onClassNode(org.objectweb.asm.ClassWriter classWriter, ClassNode classNode)` Converts the generated class writer output into a defined class.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### protected ClassCollector(GroovyClassLoader.InnerLoader cl, CompilationUnit unit, SourceUnit su)

      Creates a class collector for the supplied compilation state.

      Parameters:
        `cl` - the defining loader used for generated classes
        `unit` - the compilation unit producing classes
        `su` - the primary source unit for the compilation round

  - ### Method Detail

    - #### public void call(org.objectweb.asm.ClassVisitor classWriter, ClassNode classNode)

    - #### protected Class createClass(byte[] code, ClassNode classNode)

      Defines a generated class from bytecode produced for a class node.

      Parameters:
        `code` - the generated bytecode
        `classNode` - the corresponding class node
      Returns:
        the defined class

    - #### public GroovyClassLoader getDefiningClassLoader()

      Returns the loader used to define generated classes.

      Returns:
        the defining class loader

    - #### public Collection getLoadedClasses()

      Returns the classes defined during the current compilation callback.

      Returns:
        the generated classes in definition order

    - #### protected Class onClassNode(org.objectweb.asm.ClassWriter classWriter, ClassNode classNode)

      Converts the generated class writer output into a defined class.

      Parameters:
        `classWriter` - the ASM writer containing generated bytecode
        `classNode` - the corresponding class node
      Returns:
        the defined class