Class SourceAwareCustomizerFactory
java.lang.Object
groovy.util.AbstractFactory
org.codehaus.groovy.control.customizers.builder.SourceAwareCustomizerFactory
- All Implemented Interfaces:
- Factory,- PostCompletionFactory
Factory for use with 
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)
     }
 - 
Nested Class SummaryNested Classes
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionnewInstance(FactoryBuilderSupport builder, Object name, Object value, Map attributes) postCompleteNode(FactoryBuilderSupport factory, Object parent, Object node) voidsetChild(FactoryBuilderSupport builder, Object parent, Object child) Methods inherited from class groovy.util.AbstractFactoryisHandlesNodeChildren, isLeaf, onFactoryRegistration, onHandleNodeAttributes, onNodeChildren, onNodeCompleted, setParent
- 
Constructor Details- 
SourceAwareCustomizerFactorypublic SourceAwareCustomizerFactory()
 
- 
- 
Method Details- 
newInstancepublic Object newInstance(FactoryBuilderSupport builder, Object name, Object value, Map attributes) throws InstantiationException, IllegalAccessException - Specified by:
- newInstancein interface- Factory
- Parameters:
- builder- the FactoryBuilder
- name- the name of the node being built
- value- the 'value' argument in the build node
- attributes- the attributes of the build arg
- Returns:
- the object created for the builder
- Throws:
- InstantiationException- if attempting to instantiate an interface or abstract class
- IllegalAccessException- if the instance can't be created due to a security violation
 
- 
setChild- Specified by:
- setChildin interface- Factory
- Overrides:
- setChildin class- AbstractFactory
 
- 
postCompleteNode- Specified by:
- postCompleteNodein interface- PostCompletionFactory
 
 
-