Griffon 1.2.0

org.codehaus.griffon.ast
[Java] Class ThreadingASTTransformation

java.lang.Object
  org.codehaus.griffon.ast.AbstractASTTransformation
      org.codehaus.griffon.ast.ThreadingASTTransformation

@GroovyASTTransformation(phase = CompilePhase.CANONICALIZATION)
public class ThreadingASTTransformation
extends AbstractASTTransformation

Handles generation of code for the @Threading annotation.

Authors:
Andres Almiray
Since:
0.9.2


Field Summary
private static String COMPILER_THREADING_KEY

static String EXECUTE_ASYNC

static String EXECUTE_FUTURE

static String EXECUTE_OUTSIDE

static String EXECUTE_SYNC

private static Logger LOG

private static ClassNode MY_TYPE

private static ClassNode UITHREAD_MANAGER_CLASS

 
Fields inherited from class AbstractASTTransformation
APPLICATION_HOLDER_TYPE, COLLECTIONS_CLASS
 
Constructor Summary
ThreadingASTTransformation()

 
Method Summary
static String getThreadingMethod(AnnotatedNode node)

static String getThreadingMethod(Policy threadingPolicy)

static Policy getThreadingPolicy(AnnotationNode annotation)

static void handleFieldForInjection(ClassNode classNode, FieldNode field)

static void handleFieldForInjection(ClassNode classNode, FieldNode field, String threadingMethod)

static void handleMethodForInjection(ClassNode classNode, MethodNode method)

static void handleMethodForInjection(ClassNode classNode, MethodNode method, String threadingMethod)

static void handlePropertyForInjection(ClassNode classNode, PropertyNode property)

static void handlePropertyForInjection(ClassNode classNode, PropertyNode property, String threadingMethod)

static boolean hasThreadingAnnotation(AnnotatedNode node)

Convenience method to see if an annotated node is @Threading.

private static boolean hasVoidOrDefAsReturnType(MethodNode method)

private static void makeVariablesShared(VariableScope scope)

private static MethodDescriptor methodDescriptorFor(MethodNode method)

static boolean skipInjection(String actionName)

private static Expression uiThreadManagerInstance()

private static boolean usesThreadingAlready(Statement stmnt)

void visit(ASTNode[] nodes, SourceUnit source)

Handles the bulk of the processing, mostly delegating to other methods.

private static boolean wrapClosure(ClosureExpression closure, String threadingMethod)

private static void wrapStatements(ClassNode declaringClass, MethodNode method, String threadingMethod)

private static void wrapStatements(ClassNode declaringClass, PropertyNode property, String threadingMethod)

private static void wrapStatements(ClassNode declaringClass, FieldNode field, String threadingMethod)

private static Statement wrapStatements(Statement code, String threadingMethod)

 
Methods inherited from class AbstractASTTransformation
addError, applicationInstance, checkNodesForAnnotationAndType, emptyMap, makeClassSafe, makeClassSafe, makeClassSafe, newClass
 

Field Detail

COMPILER_THREADING_KEY

private static final String COMPILER_THREADING_KEY


EXECUTE_ASYNC

public static final String EXECUTE_ASYNC


EXECUTE_FUTURE

public static final String EXECUTE_FUTURE


EXECUTE_OUTSIDE

public static final String EXECUTE_OUTSIDE


EXECUTE_SYNC

public static final String EXECUTE_SYNC


LOG

private static final Logger LOG


MY_TYPE

private static ClassNode MY_TYPE


UITHREAD_MANAGER_CLASS

private static ClassNode UITHREAD_MANAGER_CLASS


 
Constructor Detail

ThreadingASTTransformation

ThreadingASTTransformation()


 
Method Detail

getThreadingMethod

public static String getThreadingMethod(AnnotatedNode node)


getThreadingMethod

public static String getThreadingMethod(Policy threadingPolicy)


getThreadingPolicy

public static Policy getThreadingPolicy(AnnotationNode annotation)


handleFieldForInjection

public static void handleFieldForInjection(ClassNode classNode, FieldNode field)


handleFieldForInjection

public static void handleFieldForInjection(ClassNode classNode, FieldNode field, String threadingMethod)


handleMethodForInjection

public static void handleMethodForInjection(ClassNode classNode, MethodNode method)


handleMethodForInjection

public static void handleMethodForInjection(ClassNode classNode, MethodNode method, String threadingMethod)


handlePropertyForInjection

public static void handlePropertyForInjection(ClassNode classNode, PropertyNode property)


handlePropertyForInjection

public static void handlePropertyForInjection(ClassNode classNode, PropertyNode property, String threadingMethod)


hasThreadingAnnotation

public static boolean hasThreadingAnnotation(AnnotatedNode node)
Convenience method to see if an annotated node is @Threading.
Parameters:
node - the node to check
Returns:
true if the node is an event publisher


hasVoidOrDefAsReturnType

private static boolean hasVoidOrDefAsReturnType(MethodNode method)


makeVariablesShared

private static void makeVariablesShared(VariableScope scope)


methodDescriptorFor

private static MethodDescriptor methodDescriptorFor(MethodNode method)


skipInjection

public static boolean skipInjection(String actionName)


uiThreadManagerInstance

private static Expression uiThreadManagerInstance()


usesThreadingAlready

private static boolean usesThreadingAlready(Statement stmnt)


visit

public void visit(ASTNode[] nodes, SourceUnit source)
Handles the bulk of the processing, mostly delegating to other methods.
Parameters:
nodes - the ast nodes
source - the source unit for the nodes


wrapClosure

private static boolean wrapClosure(ClosureExpression closure, String threadingMethod)


wrapStatements

private static void wrapStatements(ClassNode declaringClass, MethodNode method, String threadingMethod)


wrapStatements

private static void wrapStatements(ClassNode declaringClass, PropertyNode property, String threadingMethod)


wrapStatements

private static void wrapStatements(ClassNode declaringClass, FieldNode field, String threadingMethod)


wrapStatements

private static Statement wrapStatements(Statement code, String threadingMethod)


 

Groovy Documentation