Top Fields Constructors Methods
org.codehaus.groovy.transform

public Class NamedVariantASTTransformation

extends AbstractASTTransformation
Class Inheritance
Annotations
@GroovyASTTransformation
phase:SEMANTIC_ANALYSIS
Imports
groovy.transform.NamedDelegate, .NamedParam, .NamedVariant, org.apache.groovy.ast.tools.AnnotatedNodeUtils, org.codehaus.groovy.ast.ASTNode, .AnnotationNode, .ClassNode, .ConstructorNode, .MethodNode, .Parameter, .PropertyNode, org.codehaus.groovy.ast.expr.ArgumentListExpression, .Expression, .MethodCallExpression, org.codehaus.groovy.ast.stmt.AssertStatement, .BlockStatement, .ForStatement, org.codehaus.groovy.ast.tools.GenericsUtils, org.codehaus.groovy.control.CompilePhase, .SourceUnit, java.util.ArrayList, .HashSet, .List, .Optional, .Set

Field Summary

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

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static Expression
asType(final Expression value, final ClassNode type, final boolean coerce)

private static Expression
containsKey(final Parameter mapParam, final String name)

private void
createMapVariant(final MethodNode mNode, final AnnotationNode anno, final Parameter mapParam, final List<Parameter> genParams, final ClassNode cNode, final BlockStatement inner, final ArgumentListExpression args, final List<String> propNames)

private static Expression
private boolean
hasDuplicates(final MethodNode mNode, final List<String> propNames, final String next)

private static Expression
namedParamValue(final Parameter mapParam, final String name, final ClassNode type, final boolean coerce, Expression defaultValue)

private boolean
processDelegateParam(final MethodNode mNode, final Parameter mapParam, final ArgumentListExpression args, final List<String> propNames, final Parameter fromParam, final boolean coerce)

private boolean
processExplicitNamedParam(final MethodNode mNode, final Parameter mapParam, final BlockStatement inner, final ArgumentListExpression args, final List<String> propNames, final Parameter fromParam, final boolean coerce)

private boolean
processImplicitNamedParam(final MethodNode mNode, final Parameter mapParam, final BlockStatement inner, final ArgumentListExpression args, final List<String> propNames, final Parameter fromParam, final boolean coerce)

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

ILLEGAL_ARGUMENT_TYPEback to summary
private static final ClassNode ILLEGAL_ARGUMENT_TYPE
NAMED_DELEGATE_TYPEback to summary
private static final ClassNode NAMED_DELEGATE_TYPE
NAMED_PARAM_TYPEback to summary
private static final ClassNode NAMED_PARAM_TYPE
NAMED_VARIANTback to summary
private static final String NAMED_VARIANT
NAMED_VARIANT_TYPEback to summary
private static final ClassNode NAMED_VARIANT_TYPE

Constructor Detail

NamedVariantASTTransformationback to summary
public NamedVariantASTTransformation()

Method Detail

asTypeback to summary
private static Expression asType(final Expression value, final ClassNode type, final boolean coerce)
containsKeyback to summary
private static Expression containsKey(final Parameter mapParam, final String name)
createMapVariantback to summary
private void createMapVariant(final MethodNode mNode, final AnnotationNode anno, final Parameter mapParam, final List<Parameter> genParams, final ClassNode cNode, final BlockStatement inner, final ArgumentListExpression args, final List<String> propNames)
defaultValueXback to summary
private static Expression defaultValueX(final ClassNode type)
hasDuplicatesback to summary
private boolean hasDuplicates(final MethodNode mNode, final List<String> propNames, final String next)
namedParamValueback to summary
private static Expression namedParamValue(final Parameter mapParam, final String name, final ClassNode type, final boolean coerce, Expression defaultValue)
processDelegateParamback to summary
private boolean processDelegateParam(final MethodNode mNode, final Parameter mapParam, final ArgumentListExpression args, final List<String> propNames, final Parameter fromParam, final boolean coerce)
processExplicitNamedParamback to summary
private boolean processExplicitNamedParam(final MethodNode mNode, final Parameter mapParam, final BlockStatement inner, final ArgumentListExpression args, final List<String> propNames, final Parameter fromParam, final boolean coerce)
processImplicitNamedParamback to summary
private boolean processImplicitNamedParam(final MethodNode mNode, final Parameter mapParam, final BlockStatement inner, final ArgumentListExpression args, final List<String> propNames, final Parameter fromParam, final boolean coerce)
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