com.longport.AsyncCallback Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of openapi-sdk Show documentation
Show all versions of openapi-sdk Show documentation
LongPort OpenAPI SDK for Java
package com.longport;
import java.util.concurrent.CompletableFuture;
/**
* @hidden
*/
public interface AsyncCallback {
public void callback(Object err, Object obj);
public static interface AsyncTask {
void run(AsyncCallback callback);
}
@SuppressWarnings("unchecked")
public static CompletableFuture executeTask(AsyncTask task) {
CompletableFuture fut = new CompletableFuture();
task.run((err, obj) -> {
if (err == null) {
fut.complete((T) obj);
} else {
fut.completeExceptionally((Throwable) err);
}
});
return fut;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy