Generates an asynchronous version of a Java interface by using APT
<dependency>
<groupId>org.codejuicer</groupId>
<artifactId>asynchronize-processor</artifactId>
<version>0.9.1</version>
</dependency>
-- Watch a 4 minutes Video overview of the library --
This processor generates an 'asynchronous' interface from a Java interface, and creates a copy of all the methods accepting an extra argument for callback.
For examples, given the interface:
@Asynchronize
public interface Hello {
String sayHello(String hello);
}
The following is generated by the processor:
public interface HelloAsync {
void sayHello(String hello, AsyncCallback<String> callback);
}
It is designed to be used for GWT by specyfing its AsyncCallback as annotation option:
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.rpc.RemoteService;
import org.codejuicer.asynchronize.annotation.Asynchronize;
@Asynchronize(callback = AsyncCallback.class)
public interface MyGwtRpcService extends RemoteService {
// ...
}
It is however indipendent from GWT and can be used also with other platforms, for example with Guava's FutureCallback. It can be used to generate interfaces that can be imported in Android.
The processor is dedicated to automate the generation of the interface only and do not provide (yet) a framework to implement asynchronous calls in java.
Work in progress - see subproject asynchronize-example
Please open a github issue for tech or documentation questions