Class DelegatingCustomizer
java.lang.Object
org.codehaus.groovy.control.customizers.CompilationCustomizer
org.codehaus.groovy.control.customizers.DelegatingCustomizer
- All Implemented Interfaces:
CompilationUnitAware,CompilationUnit.IPrimaryClassNodeOperation
- Direct Known Subclasses:
SourceAwareCustomizer
public abstract class DelegatingCustomizer
extends CompilationCustomizer
implements CompilationUnitAware
Base class for compilation customizers which delegate to another customizer. The phase this
customizer runs at is retrieved from the phase of the delegate.
- Since:
- 2.1.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final CompilationCustomizerCustomizer that receives delegated callbacks. -
Constructor Summary
ConstructorsConstructorDescriptionDelegatingCustomizer(CompilationCustomizer delegate) Creates a delegating customizer backed by another customizer. -
Method Summary
Modifier and TypeMethodDescriptionvoidcall(SourceUnit source, GeneratorContext context, ClassNode classNode) Delegates customization of the supplied class node.voidsetCompilationUnit(CompilationUnit compilationUnit) Forwards the compilation unit to the delegate when it supports the callback.Methods inherited from class org.codehaus.groovy.control.customizers.CompilationCustomizer
getPhaseMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.codehaus.groovy.control.CompilationUnit.IPrimaryClassNodeOperation
doPhaseOperation, needSortedInput
-
Field Details
-
delegate
Customizer that receives delegated callbacks.
-
-
Constructor Details
-
DelegatingCustomizer
Creates a delegating customizer backed by another customizer.- Parameters:
delegate- the customizer to delegate to
-
-
Method Details
-
setCompilationUnit
Forwards the compilation unit to the delegate when it supports the callback.- Specified by:
setCompilationUnitin interfaceCompilationUnitAware- Parameters:
compilationUnit- the active compilation unit
-
call
public void call(SourceUnit source, GeneratorContext context, ClassNode classNode) throws CompilationFailedException Delegates customization of the supplied class node.- Specified by:
callin interfaceCompilationUnit.IPrimaryClassNodeOperation- Parameters:
source- the source unit being compiledcontext- the current generator contextclassNode- the class node being customized- Throws:
CompilationFailedException- if the delegate fails
-