Top Description Fields Constructors Methods
org.codehaus.groovy.transform

public Class SingletonASTTransformation

extends AbstractASTTransformation
Class Inheritance
Annotations
@GroovyASTTransformation
phase:CANONICALIZATION
Imports
org.codehaus.groovy.ast.ASTNode, .AnnotatedNode, .AnnotationNode, .ClassNode, .ConstructorNode, .FieldNode, .Parameter, org.codehaus.groovy.ast.expr.Expression, org.codehaus.groovy.ast.stmt.BlockStatement, .Statement, .SynchronizedStatement, org.codehaus.groovy.control.CompilePhase, .SourceUnit, java.util.List

Handles generation of code for the @Singleton annotation

Field Summary

Inherited from org.codehaus.groovy.transform.AbstractASTTransformation:
RETENTION_CLASSNODEsourceUnit

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private void
createConstructor(ClassNode classNode, FieldNode field, String propertyName, boolean isStrict)

private void
createField(ClassNode classNode, String propertyName, boolean isLazy, boolean isStrict)

private static String
getGetterName(String propertyName)

private static Statement
lazyBody(ClassNode classNode, FieldNode fieldNode)

private static Statement
public void
visit(ASTNode[]
The ASTnodes when the call was triggered. Element 0 is the AnnotationNode that triggered this annotation to be activated. Element 1 is the AnnotatedNode decorated, such as a MethodNode or ClassNode. For global transformations it is usually safe to ignore this parameter.
nodes
,
SourceUnit
The source unit being compiled. The source unit may contain several classes. For global transformations, information about the AST can be retrieved from this object.
source
)

Implements org.codehaus.groovy.transform.ASTTransformation.visit.

The method is invoked when an AST Transformation is active.
Inherited from org.codehaus.groovy.transform.AbstractASTTransformation:
addErrorcheckIncludeExcludecheckIncludeExcludecheckIncludeExcludeUndefinedAwarecheckIncludeExcludeUndefinedAwarecheckNotInterfacecheckPropertyListcheckPropertyListcheckPropertyListcopyAnnotatedNodeAnnotationscopyAnnotatedNodeAnnotationsdeemedInternalNamegetAnnotationNamegetClassListgetMemberClassListgetMemberClassValuegetMemberClassValuegetMemberIntValuegetMemberListgetMemberStringListgetMemberStringValuegetMemberStringValuegetMemberValuehasAnnotationinitmemberHasValuenonGenericshouldSkipshouldSkipshouldSkipOnDescriptorshouldSkipOnDescriptorUndefinedAwareshouldSkipUndefinedAwareshouldSkipUndefinedAwaretokenize

Constructor Detail

SingletonASTTransformationback to summary
public SingletonASTTransformation()

Method Detail

createConstructorback to summary
private void createConstructor(ClassNode classNode, FieldNode field, String propertyName, boolean isStrict)
createFieldback to summary
private void createField(ClassNode classNode, String propertyName, boolean isLazy, boolean isStrict)
getGetterNameback to summary
private static String getGetterName(String propertyName)
lazyBodyback to summary
private static Statement lazyBody(ClassNode classNode, FieldNode fieldNode)
nonLazyBodyback to summary
private static Statement nonLazyBody(FieldNode fieldNode)
visitback to summary
public void visit(ASTNode[] nodes, SourceUnit source)

Implements org.codehaus.groovy.transform.ASTTransformation.visit.

Doc from org.codehaus.groovy.transform.ASTTransformation.visit.

The method is invoked when an AST Transformation is active. For local transformations, it is invoked once each time the local annotation is encountered. For global transformations, it is invoked once for every source unit, which is typically a source file.

Parameters
nodes:ASTNode[]

The ASTnodes when the call was triggered. Element 0 is the AnnotationNode that triggered this annotation to be activated. Element 1 is the AnnotatedNode decorated, such as a MethodNode or ClassNode. For global transformations it is usually safe to ignore this parameter.

source:SourceUnit

The source unit being compiled. The source unit may contain several classes. For global transformations, information about the AST can be retrieved from this object.