@groovy.transform.CompileStatic abstract class AbstractMethodDecoratingTransformation extends AbstractGormASTTransformation
An abstract implementation for transformations that decorate a method invocation such that the method invocation is wrapped in the execution of a closure that delegates to the original logic. Examples of such transformations are Transactional and CurrentTenant
| Modifiers | Name | Description |
|---|---|---|
static java.lang.String |
DECORATED_METHODS |
Key used to store within the original method node metadata, all previous decorated methods |
| Constructor and description |
|---|
AbstractMethodDecoratingTransformation
() |
| Type Params | Return Type | Name and description |
|---|---|---|
|
protected org.codehaus.groovy.ast.expr.MethodCallExpression |
buildCallToOriginalMethod(ClassNode classNode, MethodNode renamedMethodNode) |
|
protected abstract org.codehaus.groovy.ast.expr.Expression |
buildDelegatingMethodCall(org.codehaus.groovy.control.SourceUnit sourceUnit, AnnotationNode annotationNode, ClassNode classNode, MethodNode methodNode, org.codehaus.groovy.ast.expr.MethodCallExpression originalMethodCallExpr, org.codehaus.groovy.ast.stmt.BlockStatement newMethodBody)Builds the delegating method call for the given class node |
|
protected void |
compileMethodStatically(org.codehaus.groovy.control.SourceUnit sourceUnit, MethodNode methodNode) |
|
protected Statement |
createDelegingMethodBody(org.codehaus.groovy.ast.Parameter[] parameters, org.codehaus.groovy.ast.expr.MethodCallExpression originalMethodCall) |
|
protected void |
enhanceClassNode(org.codehaus.groovy.control.SourceUnit sourceUnit, AnnotationNode annotationNode, ClassNode classNode)Add any additional logic to enhance the class node |
|
protected abstract java.lang.String |
getRenamedMethodPrefix() |
|
protected boolean |
hasExcludedAnnotation(MethodNode md) |
|
protected boolean |
hasExcludedAnnotation(MethodNode md, java.util.Set<java.lang.String> excludes) |
|
protected boolean |
isTestSetupOrCleanup(ClassNode classNode, MethodNode md) |
|
protected org.codehaus.groovy.ast.expr.MethodCallExpression |
makeDelegatingClosureCall(org.codehaus.groovy.ast.expr.Expression targetObject, java.lang.String executeMethodName, org.codehaus.groovy.ast.Parameter[] closureParameters, org.codehaus.groovy.ast.expr.MethodCallExpression originalMethodCall, VariableScope variableScope)Construct a method call that wraps an original call with a closure invocation |
|
protected org.codehaus.groovy.ast.expr.MethodCallExpression |
makeDelegatingClosureCall(org.codehaus.groovy.ast.expr.Expression targetObject, java.lang.String executeMethodName, ArgumentListExpression arguments, org.codehaus.groovy.ast.Parameter[] closureParameters, org.codehaus.groovy.ast.expr.MethodCallExpression originalMethodCall, VariableScope variableScope)Construct a method call that wraps an original call with a closure invocation |
|
protected MethodNode |
moveOriginalCodeToNewMethod(MethodNode methodNode, java.lang.String renamedMethodName, org.codehaus.groovy.ast.Parameter[] newParameters, ClassNode classNode, org.codehaus.groovy.control.SourceUnit source, java.util.Map<java.lang.String, ClassNode> genericsSpec) |
|
protected org.codehaus.groovy.ast.Parameter[] |
prepareNewMethodParameters(MethodNode methodNode, java.util.Map<java.lang.String, ClassNode> genericsSpec, ClassNode classNode) |
|
protected ClassNode |
resolveReturnTypeForNewMethod(MethodNode methodNode) |
|
void |
visit(org.codehaus.groovy.control.SourceUnit source, AnnotationNode annotationNode, AnnotatedNode annotatedNode) |
|
protected void |
weaveClassNode(org.codehaus.groovy.control.SourceUnit source, AnnotationNode annotationNode, ClassNode classNode) |
|
protected MethodNode |
weaveNewMethod(org.codehaus.groovy.control.SourceUnit sourceUnit, AnnotationNode annotationNode, ClassNode classNode, MethodNode methodNode, java.util.Map<java.lang.String, ClassNode> genericsSpec)Weaves a new method |
|
protected void |
weaveTestSetupMethod(org.codehaus.groovy.control.SourceUnit sourceUnit, AnnotationNode annotationNode, ClassNode classNode, MethodNode methodNode, java.util.Map<java.lang.String, ClassNode> genericsSpec) |
| Methods inherited from class | Name |
|---|---|
class AbstractGormASTTransformation |
getAnnotationType, getAppliedMarker, isValidAnnotation, visit, visit |
Key used to store within the original method node metadata, all previous decorated methods
Builds the delegating method call for the given class node
sourceUnit - The source unitannotationNode - The annotation nodeclassNode - The class nodemethodNode - The original method nodeoriginalMethodCallExpr - The method call expression that invokes the original logicnewMethodBody - The new method bodyAdd any additional logic to enhance the class node
sourceUnit - The source unitannotationNode - The annotation nodeclassNode - The class nodeConstruct a method call that wraps an original call with a closure invocation
targetObject - The target objectexecuteMethodName - The method that accepts a closureclosureParameters - The parameters for the closureoriginalMethodCall - The original method call to delegate toConstruct a method call that wraps an original call with a closure invocation
targetObject - The target objectexecuteMethodName - The method that accepts a closureclosureParameters - The parameters for the closureoriginalMethodCall - The original method call to delegate toWeaves a new method
sourceUnit - The source unitannotationNode - The annotation nodeclassNode - The class nodemethodNode - The original method that will delete to the new method