Package asteroid.internal
Class TransformationUtils
- java.lang.Object
-
- asteroid.internal.TransformationUtils
-
public final class TransformationUtils extends Object
A set of utilities to implement base transformation classes- Since:
- 0.2.0
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddASTAnnotationsFromTo(ClassNode annotated, CompilePhase compilePhase)All transformation will be always annotated with:InheritConstructorsGroovyASTTransformationTo avoid repeating this over and over again this method adds both to the annotatedClassNodepassed as first argumentstatic PropertyExpressiongetCompilePhaseAsPropertyExpression(CompilePhase compilePhase)Creates aPropertyExpressioncontaining aCompilePhase.static AnnotationNodegetGroovyAnnotation(CompilePhase compilePhase)Creates anAnnotationNodeof typeGroovyASTTransformation.static AnnotationNodegetInheritConstructorsAnnotation()Builds aAnnotationNodeof typeInheritConstructors
-
-
-
Method Detail
-
addASTAnnotationsFromTo
public static void addASTAnnotationsFromTo(ClassNode annotated, CompilePhase compilePhase)
All transformation will be always annotated with: To avoid repeating this over and over again this method adds both to the annotatedClassNodepassed as first argument- Parameters:
annotated- TheClassNodewe want to add both annotations tocompilePhase- TheCompilePhaseused as argument for theGroovyASTTransformationannotation.- Since:
- 0.2.0
-
getGroovyAnnotation
public static AnnotationNode getGroovyAnnotation(CompilePhase compilePhase)
Creates anAnnotationNodeof typeGroovyASTTransformation.- Parameters:
compilePhase- the targetCompilePhaseused as value of theGroovyASTTransformationannotation- Returns:
- an instance of
GroovyASTTransformationannotation - Since:
- 0.2.0
-
getCompilePhaseAsPropertyExpression
public static PropertyExpression getCompilePhaseAsPropertyExpression(CompilePhase compilePhase)
Creates aPropertyExpressioncontaining aCompilePhase. This property can be used, for instance, as default value for a given annotation.- Parameters:
compilePhase- an instance ofCompilePhase- Returns:
- a
PropertyExpression - Since:
- 0.2.0
-
getInheritConstructorsAnnotation
public static AnnotationNode getInheritConstructorsAnnotation()
Builds aAnnotationNodeof typeInheritConstructors- Returns:
- a
AnnotationNoderepresenting aInheritConstructors - Since:
- 0.2.0
-
-