I'm using a service that gives me back a CompletableFuture promise, the thing is, i can only access its methods through reflection which is working just fine. But treating the return of the promise is leaving me puzzled.
Normally one would use something like this to work with a CompletableFuture:
promise.thenApply(returnValue -> {
//do something with it
});
How would one do that with reflection?
promise.getClass()
.getMethod("thenApply", ??)
.invoke(retorno, ??);
Basically i want to pass a Lambda function to treat the returning of my promise but i'm unsure on how to do it and if it's possible to do it.
Aucun commentaire:
Enregistrer un commentaire