@Retention(value=RUNTIME) @Target(value={TYPE,METHOD}) public @interface Threading
Annotates a calls or method.
Annotated elements must follow these rulesgriffon.util.GriffonClassUtils.isPlainMethod() if it's a methodgriffon.util.Threading.Policy as value, with Threading.Policy.OUTSIDE_UITHREAD being
the default value.
The following snippet exemplifies the compactness of code when the annotation is applied
import griffon.transform.Threading
class Sample {
@Threading
void doSomethingOutside(String arg) {
println "Outside $arg"
}
@Threading(Threading.Policy.INSIDE_UITHREAD_SYNC)
void doSomethingInside(String arg) {
println "Inside $arg"
}
}
The equivalent, non-annotated code is
import griffon.core.threading.UIThreadManager
class Sample {
void doSomethingOutside(String arg) {
UIThreadManager.instance.executeOutside {
println "Outside $arg"
}
}
void doSomethingInside(String arg) {
UIThreadManager.instance.executeSync {
println "Inside $arg"
}
}
}
Threading.Policy| Modifier and Type | Optional Element and Description |
|---|---|
Threading.Policy |
value |
public abstract Threading.Policy value