Top Description Constructors Methods
org.codehaus.groovy.transform

public Class CategoryASTTransformation

extends Object
implements ASTTransformation
Class Inheritance
All Implemented Interfaces
org.codehaus.groovy.transform.ASTTransformation
Annotations
@GroovyASTTransformation
phase:CANONICALIZATION
Imports
groovy.lang.Reference, org.codehaus.groovy.ast.ASTNode, .AnnotationNode, .ClassCodeExpressionTransformer, .ClassHelper, .ClassNode, .FieldNode, .MethodNode, .Parameter, .PropertyNode, org.codehaus.groovy.ast.expr.ClassExpression, .ClosureExpression, .DeclarationExpression, .Expression, .MethodCallExpression, .PropertyExpression, .VariableExpression, org.codehaus.groovy.ast.stmt.BlockStatement, .CatchStatement, .ExpressionStatement, .ForStatement, org.codehaus.groovy.classgen.VariableScopeVisitor, org.codehaus.groovy.control.CompilePhase, .SourceUnit, org.codehaus.groovy.syntax.SyntaxException, org.objectweb.asm.Opcodes, java.util.HashSet, .LinkedList, .Set

Handles generation of code for the @Category annotation.

Transformation logic is as follows:

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static void
addUnsupportedInstanceMemberError(final String name, final ASTNode node, final SourceUnit unit)

private static boolean
ensureNoInstanceFieldOrProperty(final ClassNode sourceClass, final SourceUnit sourceUnit)

private void
transformReferencesToThis(final ClassNode targetClass, final ClassNode sourceClass, final SourceUnit sourceUnit)

public void
visit(final 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
,
final 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.
sourceUnit
)

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

The method is invoked when an AST Transformation is active.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

CategoryASTTransformationback to summary
public CategoryASTTransformation()

Method Detail

addUnsupportedInstanceMemberErrorback to summary
private static void addUnsupportedInstanceMemberError(final String name, final ASTNode node, final SourceUnit unit)
ensureNoInstanceFieldOrPropertyback to summary
private static boolean ensureNoInstanceFieldOrProperty(final ClassNode sourceClass, final SourceUnit sourceUnit)
transformReferencesToThisback to summary
private void transformReferencesToThis(final ClassNode targetClass, final ClassNode sourceClass, final SourceUnit sourceUnit)
visitback to summary
public void visit(final ASTNode[] nodes, final SourceUnit sourceUnit)

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.

sourceUnit: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.

Annotations
@Override