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

public Class DelegateASTTransformation

extends AbstractASTTransformation
Class Inheritance
Annotations
@GroovyASTTransformation
phase:CANONICALIZATION
Imports
groovy.lang.Delegate, .Lazy, .Reference, org.codehaus.groovy.GroovyBugError, org.codehaus.groovy.ast.ASTNode, .AnnotatedNode, .AnnotationNode, .ClassHelper, .ClassNode, .FieldNode, .GenericsType, .MethodNode, .Parameter, .PropertyNode, org.codehaus.groovy.ast.expr.ArgumentListExpression, .Expression, .MethodCallExpression, org.codehaus.groovy.ast.tools.BeanUtils, org.codehaus.groovy.control.CompilePhase, .SourceUnit, java.util.ArrayList, .HashSet, .List, .ListIterator, .Map, .Set

Handles generation of code for the @Delegate annotation

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class

Field Summary

Modifier and TypeField and Description
private static final ClassNode
private static final ClassNode
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final ClassNode
private static final String
Inherited from org.codehaus.groovy.transform.AbstractASTTransformation:
RETENTION_CLASSNODEsourceUnit

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private void
private static void
addGetterIfNeeded(final DelegateASTTransformation.DelegateDescription delegate, final PropertyNode prop, final String name, final boolean allNames)

private static void
addSetterIfNeeded(final DelegateASTTransformation.DelegateDescription delegate, final PropertyNode prop, final String name, final boolean allNames)

private boolean
checkPropertyOrMethodList(final ClassNode cNode, final List<String> propertyNameList, final String listName, final AnnotationNode anno, final String typeName)

private static boolean
clashesWithOtherParams(final String name, final Parameter[] params, final int i)

private static List<MethodNode>
private static void
extractAccessorInfo(final ClassNode owner, final String name, final Reference<Boolean> willHaveGetAccessor, final Reference<Boolean> willHaveIsAccessor)

private static List<MethodNode>
filterMethods(final List<MethodNode> methods, final DelegateASTTransformation.DelegateDescription delegate, final boolean allNames, final boolean includeDeprecated)

private static List<String>
private static String
getParamName(final Parameter[] params, final int i, final String fieldName)

private static boolean
shouldSkipPropertyMethod(final String propertyName, final String methodName, final List<String> excludes, final List<String> includes, final boolean allNames)

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

Field Detail

DEPRECATED_TYPEback to summary
private static final ClassNode DEPRECATED_TYPE
LAZY_TYPEback to summary
private static final ClassNode LAZY_TYPE
MEMBER_ALL_NAMESback to summary
private static final String MEMBER_ALL_NAMES
MEMBER_DEPRECATEDback to summary
private static final String MEMBER_DEPRECATED
MEMBER_EXCLUDE_TYPESback to summary
private static final String MEMBER_EXCLUDE_TYPES
MEMBER_EXCLUDESback to summary
private static final String MEMBER_EXCLUDES
MEMBER_INCLUDE_TYPESback to summary
private static final String MEMBER_INCLUDE_TYPES
MEMBER_INCLUDESback to summary
private static final String MEMBER_INCLUDES
MEMBER_INTERFACESback to summary
private static final String MEMBER_INTERFACES
MEMBER_METHOD_ANNOTATIONSback to summary
private static final String MEMBER_METHOD_ANNOTATIONS
MEMBER_PARAMETER_ANNOTATIONSback to summary
private static final String MEMBER_PARAMETER_ANNOTATIONS
MY_TYPEback to summary
private static final ClassNode MY_TYPE
MY_TYPE_NAMEback to summary
private static final String MY_TYPE_NAME

Constructor Detail

DelegateASTTransformationback to summary
public DelegateASTTransformation()

Method Detail

addDelegateMethodback to summary
private void addDelegateMethod(final MethodNode candidate, final DelegateASTTransformation.DelegateDescription delegate, final Iterable<MethodNode> ownMethods)
addGetterIfNeededback to summary
private static void addGetterIfNeeded(final DelegateASTTransformation.DelegateDescription delegate, final PropertyNode prop, final String name, final boolean allNames)
addSetterIfNeededback to summary
private static void addSetterIfNeeded(final DelegateASTTransformation.DelegateDescription delegate, final PropertyNode prop, final String name, final boolean allNames)
checkPropertyOrMethodListback to summary
private boolean checkPropertyOrMethodList(final ClassNode cNode, final List<String> propertyNameList, final String listName, final AnnotationNode anno, final String typeName)
clashesWithOtherParamsback to summary
private static boolean clashesWithOtherParams(final String name, final Parameter[] params, final int i)
collectMethodsback to summary
private static List<MethodNode> collectMethods(final ClassNode type)
extractAccessorInfoback to summary
private static void extractAccessorInfo(final ClassNode owner, final String name, final Reference<Boolean> willHaveGetAccessor, final Reference<Boolean> willHaveIsAccessor)
filterMethodsback to summary
private static List<MethodNode> filterMethods(final List<MethodNode> methods, final DelegateASTTransformation.DelegateDescription delegate, final boolean allNames, final boolean includeDeprecated)
getGenericPlaceholderNamesback to summary
private static List<String> getGenericPlaceholderNames(final MethodNode candidate)
getParamNameback to summary
private static String getParamName(final Parameter[] params, final int i, final String fieldName)
shouldSkipPropertyMethodback to summary
private static boolean shouldSkipPropertyMethod(final String propertyName, final String methodName, final List<String> excludes, final List<String> includes, final boolean allNames)
visitback to summary
public void visit(final ASTNode[] nodes, final 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.

Annotations
@Override
org.codehaus.groovy.transform back to summary

pack-priv Class DelegateASTTransformation.DelegateDescription

extends Object
Class Inheritance
  • java.lang.Object
  • org.codehaus.groovy.transform.DelegateASTTransformation.DelegateDescription

Field Summary

Modifier and TypeField and Description
pack-priv AnnotationNode
pack-priv AnnotatedNode
pack-priv List<String>
pack-priv List<ClassNode>
pack-priv Expression
pack-priv List<String>
pack-priv List<ClassNode>
pack-priv String
pack-priv String
pack-priv ClassNode
pack-priv ClassNode

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

annotationback to summary
pack-priv AnnotationNode annotation
delegateback to summary
pack-priv AnnotatedNode delegate
excludesback to summary
pack-priv List<String> excludes
excludeTypesback to summary
pack-priv List<ClassNode> excludeTypes
getOpback to summary
pack-priv Expression getOp
includesback to summary
pack-priv List<String> includes
includeTypesback to summary
pack-priv List<ClassNode> includeTypes
nameback to summary
pack-priv String name
originback to summary
pack-priv String origin
ownerback to summary
pack-priv ClassNode owner
typeback to summary
pack-priv ClassNode type

Constructor Detail

DelegateDescriptionback to summary
pack-priv DelegateDescription()