/** * Create a {@link FutureCallback} from an Effect to be run if there is a * success. * * @param effect To be passed the produced value if it happens * @return The FutureCallback with a no-op onFailure */ public static <A> FutureCallback<A> onSuccessDo(final Effect<? super A> effect) { return futureCallback(effect, Effects.<Throwable> noop()); }
/** * Create a {@link FutureCallback} from an Effect to be run if there is a * failure. * * @param effect To be passed an exception if it happens * @return The FutureCallback with a no-op onSuccess */ public static <A> FutureCallback<A> onFailureDo(final Effect<Throwable> effect) { return futureCallback(Effects.<A> noop(), effect); }
public Pair<InputStream, Effect<Object>> getInputStreamWithCloseHandler(final AttachmentGetData attachmentGetData) { try { if (attachmentGetData instanceof AttachmentFileGetData) { final AttachmentFileGetData fileGetData = (AttachmentFileGetData) attachmentGetData; final File file = fileGetData.getFile(); return getInputStreamForFile(file, Effects.noop()); } else { return getStreamCopiedToTemporaryFile(attachmentGetData); } } catch (final Exception e) { throw new RuntimeException(e); } }