public class SourceAwareCustomizer extends DelegatingCustomizer
A base class for customizers which only have to be applied on specific source units. This is for example useful if you want a customizer to be applied only for files matching some extensions.
For convenience, this class implements several methods that you may extend to customize
the behaviour of this utility. For example, if you want to apply a customizer only
for classes matching the '.foo' file extension, then you only have to override the
acceptExtension(String)
method:
return "foo".equals(extension)
delegate
Constructor and Description |
---|
SourceAwareCustomizer(CompilationCustomizer delegate) |
Modifier and Type | Method and Description |
---|---|
boolean |
accept(java.lang.String fileName) |
boolean |
acceptBaseName(java.lang.String baseName) |
boolean |
acceptExtension(java.lang.String extension) |
boolean |
acceptSource(SourceUnit unit) |
void |
call(SourceUnit source,
GeneratorContext context,
ClassNode classNode) |
void |
setBaseNameValidator(Closure<java.lang.Boolean> baseNameValidator) |
void |
setExtensionValidator(Closure<java.lang.Boolean> extensionValidator) |
void |
setSourceUnitValidator(Closure<java.lang.Boolean> sourceUnitValidator) |
getPhase
needSortedInput
public SourceAwareCustomizer(CompilationCustomizer delegate)
public void call(SourceUnit source, GeneratorContext context, ClassNode classNode) throws CompilationFailedException
call
in class DelegatingCustomizer
CompilationFailedException
public void setBaseNameValidator(Closure<java.lang.Boolean> baseNameValidator)
public void setExtensionValidator(Closure<java.lang.Boolean> extensionValidator)
public void setSourceUnitValidator(Closure<java.lang.Boolean> sourceUnitValidator)
public boolean accept(java.lang.String fileName)
public boolean acceptSource(SourceUnit unit)
public boolean acceptExtension(java.lang.String extension)
public boolean acceptBaseName(java.lang.String baseName)