
com.koushikdutta.async.future.TransformFuture Maven / Gradle / Ivy
package com.koushikdutta.async.future;
public abstract class TransformFuture extends SimpleFuture implements FutureCallback {
@Override
public void onCompleted(Exception e, F result) {
if (isCancelled())
return;
if (e != null) {
error(e);
return;
}
try {
transform(result);
}
catch (Exception ex) {
error(ex);
}
}
protected void error(Exception e) {
setComplete(e);
}
protected abstract void transform(F result) throws Exception;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy