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

public Class BuilderASTTransformation

extends AbstractASTTransformation
implements CompilationUnitAware
Class Inheritance
All Implemented Interfaces
groovy.transform.CompilationUnitAware
Annotations
@GroovyASTTransformation
phase:SEMANTIC_ANALYSIS
Imports
groovy.lang.GroovyClassLoader, groovy.transform.CompilationUnitAware, groovy.transform.builder.Builder, .DefaultStrategy, org.codehaus.groovy.ast.ASTNode, .AnnotatedNode, .AnnotationNode, .ClassHelper, .ClassNode, .ConstructorNode, .FieldNode, .MethodNode, .Parameter, .PropertyNode, org.codehaus.groovy.ast.tools.BeanUtils, org.codehaus.groovy.control.CompilationUnit, .CompilePhase, .SourceUnit, java.beans.BeanInfo, .IntrospectionException, .Introspector, .PropertyDescriptor, java.util.ArrayList, .List

Handles generation of code for the Builder annotation.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public abstract static class
public static interface

Field Summary

Modifier and TypeField and Description
private CompilationUnit
private static final Class<T>
private static final ClassNode
public static final String
public static final ClassNode[]
public static final Parameter[]
Inherited from org.codehaus.groovy.transform.AbstractASTTransformation:
RETENTION_CLASSNODEsourceUnit

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private boolean
checkStatic(MethodNode mNode, String annotationName)

private BuilderASTTransformation.BuilderStrategy
public void
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

Field Detail

compilationUnitback to summary
private CompilationUnit compilationUnit
MY_CLASSback to summary
private static final Class<T> MY_CLASS
MY_TYPEback to summary
private static final ClassNode MY_TYPE
MY_TYPE_NAMEback to summary
public static final String MY_TYPE_NAME
NO_EXCEPTIONSback to summary
public static final ClassNode[] NO_EXCEPTIONS
NO_PARAMSback to summary
public static final Parameter[] NO_PARAMS

Constructor Detail

BuilderASTTransformationback to summary
public BuilderASTTransformation()

Method Detail

checkStaticback to summary
private boolean checkStatic(MethodNode mNode, String annotationName)
createBuilderStrategyback to summary
private BuilderASTTransformation.BuilderStrategy createBuilderStrategy(AnnotationNode anno, GroovyClassLoader loader)
setCompilationUnitback to summary
public void setCompilationUnit(final CompilationUnit unit)

Implements groovy.transform.CompilationUnitAware.setCompilationUnit.

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.

org.codehaus.groovy.transform back to summary

public abstract Class BuilderASTTransformation.AbstractBuilderStrategy

extends Object
implements BuilderStrategy
Class Inheritance
  • java.lang.Object
  • org.codehaus.groovy.transform.BuilderASTTransformation.AbstractBuilderStrategy
All Implemented Interfaces
org.codehaus.groovy.transform.BuilderASTTransformation.BuilderStrategy
Known Direct Subclasses
groovy.transform.builder.DefaultStrategy, groovy.transform.builder.ExternalStrategy, groovy.transform.builder.InitializerStrategy, groovy.transform.builder.SimpleStrategy

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static class

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected void
protected void
protected List<FieldNode>
protected boolean
protected static List<BuilderASTTransformation.AbstractBuilderStrategy.PropertyInfo>
getPropertyInfoFromBeanInfo(ClassNode cNode, List<String> includes, List<String> excludes, boolean allNames)

protected static List<BuilderASTTransformation.AbstractBuilderStrategy.PropertyInfo>
protected static List<BuilderASTTransformation.AbstractBuilderStrategy.PropertyInfo>
getPropertyInfoFromClassNode(ClassNode cNode, List<String> includes, List<String> excludes, boolean allNames)

protected List<BuilderASTTransformation.AbstractBuilderStrategy.PropertyInfo>
getPropertyInfoFromClassNode(BuilderASTTransformation transform, AnnotationNode anno, ClassNode cNode, List<String> includes, List<String> excludes, boolean allNames, boolean allProperties)

protected List<BuilderASTTransformation.AbstractBuilderStrategy.PropertyInfo>
getPropertyInfos(BuilderASTTransformation transform, AnnotationNode anno, ClassNode buildee, List<String> excludes, List<String> includes, boolean allNames, boolean allProperties)

protected String
getSetterName(String prefix, String fieldName)

protected boolean
protected boolean
unsupportedAttribute(BuilderASTTransformation transform, AnnotationNode anno, String memberName, String extraMessage)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

AbstractBuilderStrategyback to summary
public AbstractBuilderStrategy()

Method Detail

checkKnownFieldback to summary
protected void checkKnownField(BuilderASTTransformation transform, AnnotationNode anno, String name, List<FieldNode> fields)
checkKnownPropertyback to summary
protected void checkKnownProperty(BuilderASTTransformation transform, AnnotationNode anno, String name, List<BuilderASTTransformation.AbstractBuilderStrategy.PropertyInfo> properties)
getFieldsback to summary
protected List<FieldNode> getFields(BuilderASTTransformation transform, AnnotationNode anno, ClassNode buildee)
getIncludeExcludeback to summary
protected boolean getIncludeExclude(BuilderASTTransformation transform, AnnotationNode anno, ClassNode cNode, List<String> excludes, List<String> includes)
getPropertyInfoFromBeanInfoback to summary
protected static List<BuilderASTTransformation.AbstractBuilderStrategy.PropertyInfo> getPropertyInfoFromBeanInfo(ClassNode cNode, List<String> includes, List<String> excludes, boolean allNames)
getPropertyInfoFromClassNodeback to summary
protected static List<BuilderASTTransformation.AbstractBuilderStrategy.PropertyInfo> getPropertyInfoFromClassNode(ClassNode cNode, List<String> includes, List<String> excludes)
getPropertyInfoFromClassNodeback to summary
protected static List<BuilderASTTransformation.AbstractBuilderStrategy.PropertyInfo> getPropertyInfoFromClassNode(ClassNode cNode, List<String> includes, List<String> excludes, boolean allNames)
getPropertyInfoFromClassNodeback to summary
protected List<BuilderASTTransformation.AbstractBuilderStrategy.PropertyInfo> getPropertyInfoFromClassNode(BuilderASTTransformation transform, AnnotationNode anno, ClassNode cNode, List<String> includes, List<String> excludes, boolean allNames, boolean allProperties)
getPropertyInfosback to summary
protected List<BuilderASTTransformation.AbstractBuilderStrategy.PropertyInfo> getPropertyInfos(BuilderASTTransformation transform, AnnotationNode anno, ClassNode buildee, List<String> excludes, List<String> includes, boolean allNames, boolean allProperties)
getSetterNameback to summary
protected String getSetterName(String prefix, String fieldName)
unsupportedAttributeback to summary
protected boolean unsupportedAttribute(BuilderASTTransformation transform, AnnotationNode anno, String memberName)
unsupportedAttributeback to summary
protected boolean unsupportedAttribute(BuilderASTTransformation transform, AnnotationNode anno, String memberName, String extraMessage)
org.codehaus.groovy.transform back to summary

protected Class BuilderASTTransformation.AbstractBuilderStrategy.PropertyInfo

extends Object
Class Inheritance
  • java.lang.Object
  • org.codehaus.groovy.transform.BuilderASTTransformation.AbstractBuilderStrategy.PropertyInfo

Field Summary

Modifier and TypeField and Description
private String
private ClassNode

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public String
public ClassNode
public void
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

nameback to summary
private String name
typeback to summary
private ClassNode type

Constructor Detail

PropertyInfoback to summary
public PropertyInfo(String name, ClassNode type)

Method Detail

getNameback to summary
public String getName()
getTypeback to summary
public ClassNode getType()
setNameback to summary
public void setName(String name)
setTypeback to summary
public void setType(ClassNode type)
org.codehaus.groovy.transform back to summary

public Interface BuilderASTTransformation.BuilderStrategy

Known Direct Implementers
org.codehaus.groovy.transform.BuilderASTTransformation.AbstractBuilderStrategy

Method Summary

Modifier and TypeMethod and Description
public void

Method Detail

buildback to summary
public void build(BuilderASTTransformation transform, AnnotatedNode annotatedNode, AnnotationNode anno)