Groovy Documentation

org.codehaus.groovy.grails.compiler.web
[Java] Class ControllerActionTransformer

java.lang.Object
  org.codehaus.groovy.grails.compiler.web.ControllerActionTransformer
All Implemented Interfaces:
AnnotatedClassInjector, GrailsArtefactClassInjector

@AstTransformer
public class ControllerActionTransformer
extends java.lang.Object

Enhances controller classes by converting closures actions to method actions and binding request parameters to action arguments.


Field Summary
static java.lang.String VOID_TYPE

 
Constructor Summary
ControllerActionTransformer()

 
Method Summary
protected void addMethodToInvokeClosure(org.codehaus.groovy.ast.ClassNode controllerClassNode, org.codehaus.groovy.ast.PropertyNode closureProperty, org.codehaus.groovy.control.SourceUnit source, org.codehaus.groovy.classgen.GeneratorContext context)

protected void annotateActionMethod(org.codehaus.groovy.ast.Parameter[] parameters, org.codehaus.groovy.ast.MethodNode methodNode)

protected void copyAnnotations(org.codehaus.groovy.ast.MethodNode from, org.codehaus.groovy.ast.MethodNode to)

java.lang.String[] getArtefactTypes()

protected org.codehaus.groovy.ast.stmt.Statement getAutoWireCommandObjectStatement(java.lang.String paramName)

protected org.codehaus.groovy.ast.stmt.Statement getCommandObjectDataBindingStatement(org.codehaus.groovy.ast.ClassNode controllerClassNode, java.lang.String paramName, org.codehaus.groovy.ast.ClassNode commandObjectClassNode)

protected org.codehaus.groovy.ast.expr.Expression getRejectValueExpression(java.lang.String methodParamName)

protected org.codehaus.groovy.ast.stmt.BlockStatement initializeActionParameters(org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.ast.ASTNode actionNode, java.lang.String actionName, org.codehaus.groovy.ast.Parameter[] actionParameters, org.codehaus.groovy.control.SourceUnit source, org.codehaus.groovy.classgen.GeneratorContext context)

protected void initializeCommandObjectParameter(org.codehaus.groovy.ast.stmt.BlockStatement wrapper, org.codehaus.groovy.ast.ClassNode controllerNode, org.codehaus.groovy.ast.ClassNode commandObjectNode, org.codehaus.groovy.ast.ASTNode actionNode, java.lang.String actionName, java.lang.String paramName, org.codehaus.groovy.control.SourceUnit source, org.codehaus.groovy.classgen.GeneratorContext context)

protected void initializeMethodParameter(org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.ast.stmt.BlockStatement wrapper, org.codehaus.groovy.ast.ASTNode actionNode, java.lang.String actionName, org.codehaus.groovy.ast.Parameter param, org.codehaus.groovy.control.SourceUnit source, org.codehaus.groovy.classgen.GeneratorContext context)

protected void initializePrimitiveOrTypeWrapperParameter(org.codehaus.groovy.ast.stmt.BlockStatement wrapper, org.codehaus.groovy.ast.Parameter param, java.lang.String requestParameterName)

protected void initializeStringParameter(org.codehaus.groovy.ast.stmt.BlockStatement wrapper, org.codehaus.groovy.ast.Parameter param, java.lang.String requestParameterName)

void performInjection(org.codehaus.groovy.control.SourceUnit source, org.codehaus.groovy.classgen.GeneratorContext context, org.codehaus.groovy.ast.ClassNode classNode)

void performInjection(org.codehaus.groovy.control.SourceUnit source, org.codehaus.groovy.ast.ClassNode classNode)

void performInjectionOnAnnotatedClass(org.codehaus.groovy.control.SourceUnit source, org.codehaus.groovy.classgen.GeneratorContext context, org.codehaus.groovy.ast.ClassNode classNode)

boolean shouldInject(java.net.URL url)

protected void transformClosureToMethod(org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.ast.expr.ClosureExpression closureAction, org.codehaus.groovy.ast.PropertyNode property, org.codehaus.groovy.control.SourceUnit source, org.codehaus.groovy.classgen.GeneratorContext context)

 
Methods inherited from class java.lang.Object
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Field Detail

VOID_TYPE

public static final java.lang.String VOID_TYPE


 
Constructor Detail

ControllerActionTransformer

public ControllerActionTransformer()


 
Method Detail

addMethodToInvokeClosure

protected void addMethodToInvokeClosure(org.codehaus.groovy.ast.ClassNode controllerClassNode, org.codehaus.groovy.ast.PropertyNode closureProperty, org.codehaus.groovy.control.SourceUnit source, org.codehaus.groovy.classgen.GeneratorContext context)


annotateActionMethod

protected void annotateActionMethod(org.codehaus.groovy.ast.Parameter[] parameters, org.codehaus.groovy.ast.MethodNode methodNode)


copyAnnotations

protected void copyAnnotations(org.codehaus.groovy.ast.MethodNode from, org.codehaus.groovy.ast.MethodNode to)


getArtefactTypes

public java.lang.String[] getArtefactTypes()


getAutoWireCommandObjectStatement

protected org.codehaus.groovy.ast.stmt.Statement getAutoWireCommandObjectStatement(java.lang.String paramName)


getCommandObjectDataBindingStatement

protected org.codehaus.groovy.ast.stmt.Statement getCommandObjectDataBindingStatement(kStatement bindingStatement org.codehaus.groovy.ast.ClassNode controllerClassNode, java.lang.String paramName, l ArgumentListExpression get org.codehaus.groovy.ast.ClassNode commandObjectClassNode)


getRejectValueExpression

protected org.codehaus.groovy.ast.expr.Expression getRejectValueExpression(java.lang.String methodParamName)


initializeActionParameters

protected org.codehaus.groovy.ast.stmt.BlockStatement initializeActionParameters(org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.ast.ASTNode actionNode, java.lang.String actionName, org.codehaus.groovy.ast.Parameter[] actionParameters, org.codehaus.groovy.control.SourceUnit source, org.codehaus.groovy.classgen.GeneratorContext context)


initializeCommandObjectParameter

protected void initializeCommandObjectParameter(org.codehaus.groovy.ast.stmt.BlockStatement wrapper, org.codehaus.groovy.ast.ClassNode controllerNode, org.codehaus.groovy.ast.ClassNode commandObjectNode, org.codehaus.groovy.ast.ASTNode actionNode, java.lang.String actionName, java.lang.String paramName, org.codehaus.groovy.control.SourceUnit source, org.codehaus.groovy.classgen.GeneratorContext context)


initializeMethodParameter

protected void initializeMethodParameter(org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.ast.stmt.BlockStatement wrapper, org.codehaus.groovy.ast.ASTNode actionNode, java.lang.String actionName, org.codehaus.groovy.ast.Parameter param, org.codehaus.groovy.control.SourceUnit source, org.codehaus.groovy.classgen.GeneratorContext context)


initializePrimitiveOrTypeWrapperParameter

protected void initializePrimitiveOrTypeWrapperParameter(org.codehaus.groovy.ast.stmt.BlockStatement wrapper, org.codehaus.groovy.ast.Parameter param, java.lang.String requestParameterName)


initializeStringParameter

protected void initializeStringParameter(org.codehaus.groovy.ast.stmt.BlockStatement wrapper, org.codehaus.groovy.ast.Parameter param, java.lang.String requestParameterName)


performInjection

public void performInjection(org.codehaus.groovy.control.SourceUnit source, org.codehaus.groovy.classgen.GeneratorContext context, org.codehaus.groovy.ast.ClassNode classNode)


performInjection

public void performInjection(org.codehaus.groovy.control.SourceUnit source, org.codehaus.groovy.ast.ClassNode classNode)


performInjectionOnAnnotatedClass

public void performInjectionOnAnnotatedClass(SourceUnit source, GeneratorContext context, ClassNode classNode) {
public void performInjectionOnAnnotatedClass(org.codehaus.groovy.control.SourceUnit source, org.codehaus.groovy.classgen.GeneratorContext context, org.codehaus.groovy.ast.ClassNode classNode)


shouldInject

public boolean shouldInject(java.net.URL url)


transformClosureToMethod

protected void transformClosureToMethod(org.codehaus.groovy.ast.ClassNode classNode, org.codehaus.groovy.ast.expr.ClosureExpression closureAction, org.codehaus.groovy.ast.PropertyNode property, org.codehaus.groovy.control.SourceUnit source, org.codehaus.groovy.classgen.GeneratorContext context)


 

Groovy Documentation