@AstTransformer public class ControllerActionTransformer extends java.lang.Object implements AnnotatedClassInjector, GrailsArtefactClassInjector, CompilationUnitAware
| Modifiers | Name | Description |
|---|---|---|
static AnnotationNode |
ACTION_ANNOTATION_NODE |
|
static java.util.regex.Pattern |
CONTROLLER_PATTERN |
|
static java.lang.String |
CONVERT_CLOSURES_KEY |
|
static AnnotationNode |
DELEGATING_METHOD_ANNOATION |
|
static java.lang.String |
EXCEPTION_HANDLER_META_DATA_FIELD_NAME |
|
static java.lang.String |
VOID_TYPE |
| Constructor and description |
|---|
ControllerActionTransformer() |
| Type Params | Return Type | Name and description |
|---|---|---|
|
protected void |
addMethodToInvokeClosure(ClassNode controllerClassNode, PropertyNode closureProperty, SourceUnit source, GeneratorContext context) |
|
protected void |
annotateActionMethod(ClassNode controllerClassNode, Parameter[] parameters, MethodNode methodNode) |
|
public java.lang.Object |
call(java.lang.Object object) |
|
public java.lang.String[] |
getArtefactTypes() |
|
protected BlockStatement |
getCodeToHandleAllowedMethods(ClassNode controllerClass, java.lang.String methodName) |
|
protected java.util.Collection<MethodNode> |
getExceptionHandlerMethods(ClassNode classNode, SourceUnit sourceUnit) |
|
protected Expression |
getRejectValueExpression(ClassNode classNode, java.lang.String methodParamName) |
|
protected BlockStatement |
initializeActionParameters(ClassNode classNode, ASTNode actionNode, java.lang.String actionName, Parameter[] actionParameters, SourceUnit source, GeneratorContext context) |
|
protected void |
initializeAndValidateCommandObjectParameter(BlockStatement wrapper, ClassNode controllerNode, ClassNode commandObjectNode, ASTNode actionNode, java.lang.String actionName, java.lang.String paramName, SourceUnit source, GeneratorContext context) |
|
protected void |
initializeCommandObjectParameter(BlockStatement wrapper, ClassNode commandObjectNode, java.lang.String paramName, SourceUnit source) |
|
protected void |
initializeMethodParameter(ClassNode classNode, BlockStatement wrapper, ASTNode actionNode, java.lang.String actionName, Parameter param, SourceUnit source, GeneratorContext context) |
|
protected void |
initializePrimitiveOrTypeWrapperParameter(ClassNode classNode, BlockStatement wrapper, Parameter param, java.lang.String requestParameterName) |
|
protected void |
initializeStringParameter(ClassNode classNode, BlockStatement wrapper, Parameter param, java.lang.String requestParameterName) |
|
protected boolean |
methodShouldBeConfiguredAsControllerAction(MethodNode method)
|
|
public void |
performInjection(SourceUnit source, GeneratorContext context, ClassNode classNode) |
|
public void |
performInjection(SourceUnit source, ClassNode classNode) |
|
public void |
performInjectionOnAnnotatedClass(SourceUnit source, GeneratorContext context, ClassNode classNode) |
|
public void |
performInjectionOnAnnotatedClass(SourceUnit source, ClassNode classNode) |
|
public void |
setCompilationUnit(CompilationUnit compilationUnit) |
|
public boolean |
shouldInject(java.net.URL url) |
|
protected void |
transformClosureToMethod(ClassNode classNode, ClosureExpression closureAction, PropertyNode property, SourceUnit source, GeneratorContext context) |
|
protected void |
wrapMethodBodyWithExceptionHandling(ClassNode controllerClassNode, MethodNode methodNode)This will wrap the method body in a try catch block which does something like this:
try {
// original method body here
} catch (Exception $caughtException) {
Method $method = getExceptionHandlerMethod($caughtException.getClass())
if($method) {
return $method.invoke(this, $caughtException)
} else {
throw $caughtException
}
}
|
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#equals(java.lang.Object), java.lang.Object#getClass(), java.lang.Object#hashCode(), java.lang.Object#notify(), java.lang.Object#notifyAll(), java.lang.Object#toString(), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int) |
method - a potential controller action methodThis will wrap the method body in a try catch block which does something like this:
try {
// original method body here
} catch (Exception $caughtException) {
Method $method = getExceptionHandlerMethod($caughtException.getClass())
if($method) {
return $method.invoke(this, $caughtException)
} else {
throw $caughtException
}
}
methodNode - the method to add the try catch block to