CompilerCustomizationBuilder. Allows the construction of source aware customizers. Syntax:
// apply CompileStatic AST annotation on .sgroovy files
builder.source(extension: 'sgroovy') {
ast(CompileStatic)
}
// apply CompileStatic AST annotation on .sgroovy or .sg files
builder.source(extensions: ['sgroovy','sg']) {
ast(CompileStatic)
}
// apply CompileStatic AST annotation on .sgroovy or .sg files
builder.source(extensionValidator: { it.name in ['sgroovy','sg']}) {
ast(CompileStatic)
}
// apply CompileStatic AST annotation on files whose name is 'foo'
builder.source(basename: 'foo') {
ast(CompileStatic)
}
// apply CompileStatic AST annotation on files whose name is 'foo' or 'bar'
builder.source(basenames: ['foo', 'bar']) {
ast(CompileStatic)
}
// apply CompileStatic AST annotation on files whose name is 'foo' or 'bar'
builder.source(basenameValidator: { it in ['foo', 'bar'] }) {
ast(CompileStatic)
}
// apply CompileStatic AST annotation on files that do not contain a class named 'Baz'
builder.source(unitValidator: { unit -> !unit.AST.classes.any { it.name == 'Baz' } }) {
ast(CompileStatic)
}
// apply CompileStatic AST annotation on class nodes that end with 'CS'
builder.source(classValidator: { cn -> cn.name.endsWith('CS') }) {
ast(CompileStatic)
}
| Modifier and Type | Class and Description |
|---|---|
| public static class |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private static void | addBasenameValidator(final SourceAwareCustomizer sourceAwareCustomizer, final SourceAwareCustomizerFactory.
|
| private static void | addExtensionValidator(final SourceAwareCustomizer sourceAwareCustomizer, final SourceAwareCustomizerFactory.
|
| public Object | newInstance(final FactoryBuilderSupport
the FactoryBuilder builder, final Object the name of the node being built name, final Object the 'value' argument in the build node value, final Map<K, V> the attributes of the build arg attributes)Implements groovy. |
| public Object | postCompleteNode(final FactoryBuilderSupport factory, final Object parent, final Object node)
Implements org. |
| public void | setChild(final FactoryBuilderSupport builder, final Object parent, final Object child)
Overrides groovy. Implements groovy. |
| SourceAwareCustomizerFactory | back to summary |
|---|---|
| public SourceAwareCustomizerFactory() | |
| addBasenameValidator | back to summary |
|---|---|
| private static void addBasenameValidator(final SourceAwareCustomizer sourceAwareCustomizer, final SourceAwareCustomizerFactory. | |
| addExtensionValidator | back to summary |
|---|---|
| private static void addExtensionValidator(final SourceAwareCustomizer sourceAwareCustomizer, final SourceAwareCustomizerFactory. | |
| newInstance | back to summary |
|---|---|
| public Object newInstance(final FactoryBuilderSupport builder, final Object name, final Object value, final Map<K, V> attributes) throws InstantiationException, IllegalAccessException Implements groovy.
| |
| postCompleteNode | back to summary |
|---|---|
| public Object postCompleteNode(final FactoryBuilderSupport factory, final Object parent, final Object node) Implements org. | |
| setChild | back to summary |
|---|---|
| public void setChild(final FactoryBuilderSupport builder, final Object parent, final Object child) Overrides groovy. Implements groovy.
| |
| Modifier and Type | Field and Description |
|---|---|
| public String | |
| public List | |
| public Closure | |
| public Closure | |
| public CompilationCustomizer | |
| public String | |
| public List | |
| public Closure | |
| public Closure |
| Access | Constructor and Description |
|---|---|
| public |
| basename | back to summary |
|---|---|
| public String basename | |
| basenames | back to summary |
|---|---|
| public List<String> basenames | |
| basenameValidator | back to summary |
|---|---|
| public Closure<Boolean> basenameValidator | |
| classValidator | back to summary |
|---|---|
| public Closure<Boolean> classValidator | |
| delegate | back to summary |
|---|---|
| public CompilationCustomizer delegate | |
| extension | back to summary |
|---|---|
| public String extension | |
| extensions | back to summary |
|---|---|
| public List<String> extensions | |
| extensionValidator | back to summary |
|---|---|
| public Closure<Boolean> extensionValidator | |
| unitValidator | back to summary |
|---|---|
| public Closure<Boolean> unitValidator | |
| SourceOptions | back to summary |
|---|---|
| public SourceOptions() | |