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

public Class ToStringASTTransformation

extends AbstractASTTransformation
Class Inheritance
Annotations
@GroovyASTTransformation
phase:CANONICALIZATION
Imports
groovy.transform.ToString, org.codehaus.groovy.ast.ASTNode, .AnnotatedNode, .AnnotationNode, .ClassHelper, .ClassNode, .FieldNode, .Parameter, .PropertyNode, org.codehaus.groovy.ast.expr.ConstantExpression, .Expression, .MethodCallExpression, .VariableExpression, org.codehaus.groovy.ast.stmt.BlockStatement, .Statement, org.codehaus.groovy.control.CompilePhase, .SourceUnit, org.codehaus.groovy.runtime.DefaultGroovyMethods, .InvokerHelper, org.codehaus.groovy.transform.stc.StaticTypeCheckingSupport, java.util.ArrayList, .Comparator, .HashSet, .List, .Set

Handles generation of code for the @ToString annotation.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private static final ClassNode
pack-priv static final Class<T>
pack-priv static final ClassNode
pack-priv 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 void
private static void
appendPrefix(BlockStatement body, Expression result, String name, boolean includeNames)

private static Statement
private static void
appendValue(BlockStatement body, Expression result, VariableExpression first, Expression value, String name, boolean includeNames, boolean ignoreNulls, boolean canBeSelf)

private static Expression
calculateToStringStatements(ClassNode cNode, boolean includeSuper, boolean includeFields, boolean includeSuperFields, List<String> excludes, final List<String> includes, boolean includeNames, boolean ignoreNulls, boolean includePackage, boolean includeSuperProperties, boolean allProperties, BlockStatement body, boolean allNames)

private static boolean
canBeSelf(ClassNode cNode, ClassNode valueType)

public static void
createToString(ClassNode cNode, boolean includeSuper, boolean includeFields, List<String> excludes, List<String> includes, boolean includeNames)

public static void
createToString(ClassNode cNode, boolean includeSuper, boolean includeFields, List<String> excludes, List<String> includes, boolean includeNames, boolean ignoreNulls)

public static void
createToString(ClassNode cNode, boolean includeSuper, boolean includeFields, List<String> excludes, List<String> includes, boolean includeNames, boolean ignoreNulls, boolean includePackage)

public static void
createToString(ClassNode cNode, boolean includeSuper, boolean includeFields, List<String> excludes, List<String> includes, boolean includeNames, boolean ignoreNulls, boolean includePackage, boolean cache)

public static void
createToString(ClassNode cNode, boolean includeSuper, boolean includeFields, List<String> excludes, List<String> includes, boolean includeNames, boolean ignoreNulls, boolean includePackage, boolean cache, boolean includeSuperProperties)

public static void
createToString(ClassNode cNode, boolean includeSuper, boolean includeFields, List<String> excludes, List<String> includes, boolean includeNames, boolean ignoreNulls, boolean includePackage, boolean cache, boolean includeSuperProperties, boolean allProperties)

public static void
createToString(ClassNode cNode, boolean includeSuper, boolean includeFields, List<String> excludes, List<String> includes, boolean includeNames, boolean ignoreNulls, boolean includePackage, boolean cache, boolean includeSuperProperties, boolean allProperties, boolean allNames, boolean includeSuperFields)

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

Field Detail

INVOKER_TYPEback to summary
private static final ClassNode INVOKER_TYPE
MY_CLASSback to summary
pack-priv static final Class<T> MY_CLASS
MY_TYPEback to summary
pack-priv static final ClassNode MY_TYPE
MY_TYPE_NAMEback to summary
pack-priv static final String MY_TYPE_NAME
STRINGBUILDER_TYPEback to summary
private static final ClassNode STRINGBUILDER_TYPE

Constructor Detail

ToStringASTTransformationback to summary
public ToStringASTTransformation()

Method Detail

appendCommaIfNotFirstback to summary
private static void appendCommaIfNotFirst(BlockStatement body, Expression result, VariableExpression first)
appendPrefixback to summary
private static void appendPrefix(BlockStatement body, Expression result, String name, boolean includeNames)
appendSback to summary
private static Statement appendS(Expression result, Expression expr)
appendValueback to summary
private static void appendValue(BlockStatement body, Expression result, VariableExpression first, Expression value, String name, boolean includeNames, boolean ignoreNulls, boolean canBeSelf)
calculateToStringStatementsback to summary
private static Expression calculateToStringStatements(ClassNode cNode, boolean includeSuper, boolean includeFields, boolean includeSuperFields, List<String> excludes, final List<String> includes, boolean includeNames, boolean ignoreNulls, boolean includePackage, boolean includeSuperProperties, boolean allProperties, BlockStatement body, boolean allNames)
canBeSelfback to summary
private static boolean canBeSelf(ClassNode cNode, ClassNode valueType)
createToStringback to summary
public static void createToString(ClassNode cNode, boolean includeSuper, boolean includeFields, List<String> excludes, List<String> includes, boolean includeNames)
createToStringback to summary
public static void createToString(ClassNode cNode, boolean includeSuper, boolean includeFields, List<String> excludes, List<String> includes, boolean includeNames, boolean ignoreNulls)
createToStringback to summary
public static void createToString(ClassNode cNode, boolean includeSuper, boolean includeFields, List<String> excludes, List<String> includes, boolean includeNames, boolean ignoreNulls, boolean includePackage)
createToStringback to summary
public static void createToString(ClassNode cNode, boolean includeSuper, boolean includeFields, List<String> excludes, List<String> includes, boolean includeNames, boolean ignoreNulls, boolean includePackage, boolean cache)
createToStringback to summary
public static void createToString(ClassNode cNode, boolean includeSuper, boolean includeFields, List<String> excludes, List<String> includes, boolean includeNames, boolean ignoreNulls, boolean includePackage, boolean cache, boolean includeSuperProperties)
createToStringback to summary
public static void createToString(ClassNode cNode, boolean includeSuper, boolean includeFields, List<String> excludes, List<String> includes, boolean includeNames, boolean ignoreNulls, boolean includePackage, boolean cache, boolean includeSuperProperties, boolean allProperties)
createToStringback to summary
public static void createToString(ClassNode cNode, boolean includeSuper, boolean includeFields, List<String> excludes, List<String> includes, boolean includeNames, boolean ignoreNulls, boolean includePackage, boolean cache, boolean includeSuperProperties, boolean allProperties, boolean allNames, boolean includeSuperFields)
toStringPropertyNameback to summary
private static Statement toStringPropertyName(Expression result, String fName)
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

private Class ToStringASTTransformation.ToStringElement

extends Object
Class Inheritance
  • java.lang.Object
  • org.codehaus.groovy.transform.ToStringASTTransformation.ToStringElement

Field Summary

Modifier and TypeField and Description
pack-priv boolean
pack-priv String
pack-priv Expression

Constructor Summary

AccessConstructor and Description
pack-priv
ToStringElement(Expression value, String name, boolean canBeSelf)

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

canBeSelfback to summary
pack-priv boolean canBeSelf
nameback to summary
pack-priv String name
valueback to summary
pack-priv Expression value

Constructor Detail

ToStringElementback to summary
pack-priv ToStringElement(Expression value, String name, boolean canBeSelf)