An AST transformation that takes each method in the given class and adds a delegate method that returns a Promise and executes the method asynchronously. For example given the following class:
class BookApi {
List listBooksByTitle(String title) { }
}
If the annotation is applied to a new class:
@DelegateAsync(BookApi)
class AsyncBookApi {}
The resulting class is transformed into:
class AsyncBookApi {
private BookApi $bookApi
Promise> listBooksByTitle(String title) {
(Promise>)Promises.createPromise {
$bookApi.listBooksByTitle(title)
}
}
}
Type | Name and description |
---|---|
java.lang.Class |
value() @default DelegateAsync |
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |