I have a little question here.
private boolean isSomethingTrue(String param) {
boolean result = false;
myService.hasAlerts(param,new Callback<Boolean>(
@Override
public void onSuccess(Boolean hasAlerts) {
result = hasAlerts;
}
});
return result;
}
On this code, how can i return the boolean hasAlerts that is received in the callback? This doesn't work because the result variable is not final. But when it's final, it can't be modified so...
I've done something like that:
private boolean isSomethingTrue(String param) {
class ResultHolder {
boolean result=false;
}
final ResultHolder resultHolder = new ResultHolder();
myService.findBoolean(param,new Callback<Boolean>(
@Override
public void onSuccess(Boolean hasAlerts) {
resultHolder.result = hasAlerts;
}
});
return resultHolder.result;
}
But is there a simpler solution to handle such a case?
I've found this problem while trying to call a GWT RPC service.