-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathTaskProxy.vm
38 lines (29 loc) · 1.03 KB
/
TaskProxy.vm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package ${packageName};
import java.util.concurrent.Future;
import org.sedlakovi.celery.Client;
public final class ${taskName}Proxy {
private final Client client;
private ${taskName}Proxy(Client client) {
this.client = client;
}
public static ${packageName}.${taskName}Proxy with(Client client) {
return new ${packageName}.${taskName}Proxy(client);
}
#foreach($method in $methods)
@SuppressWarnings("unchecked")
public Future<${method.returnType}> ${method.simpleName}(
#foreach($param in $method.parameters)
${param.type} ${param.simpleName}#if( $foreach.hasNext ),#end
#end
) throws java.io.IOException {
return (Future<${method.returnType}>) client.submit(
${packageName}.${taskName}.class,
"${method.simpleName}",
new Object[]{
#foreach($param in $method.parameters)
${param.simpleName}#if( $foreach.hasNext ),#end
#end
});
}
#end
}