@Override public void failed(Throwable x) { failed.call(x); } };
/** * Converts an {@link Action1} to a function that calls the action and returns {@code null}. * * @param action the {@link Action1} to convert * @return a {@link Func1} that calls {@code action} and returns {@code null} */ public static <T1> Func1<T1, Void> toFunc(final Action1<T1> action) { return toFunc(action, (Void) null); }
@Override public void failedAcceptingSession(Integer sessionId, Throwable t) throws Throwable { if (failedAcceptance != null) { failedAcceptance.call(sessionId, t); } }
@Override public boolean headerComplete(Request request, Response response, HTTPOutputStream output, HTTPConnection connection) { if (headerComplete != null) { return headerComplete.call(request, response, output, connection); } else { return false; } }
@Override public R call() { action.call(); return result; } };
@Override public boolean content(ByteBuffer item, Request request, Response response, HTTPOutputStream output, HTTPConnection connection) { if (content != null) { return content.call(item, request, response, output, connection); } else { return false; } }
@Override public void badMessage(int status, String reason, Request request, Response response, HTTPOutputStream output, HTTPConnection connection) { if (badMessage != null) { badMessage.call(status, reason, request, response, output, connection); } }
@Override public void earlyEOF(Request request, Response response, HTTPOutputStream output, HTTPConnection connection) { if (earlyEOF != null) { earlyEOF.call(request, response, output, connection); } }
@Override public R call(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8) { action.call(t1, t2, t3, t4, t5, t6, t7, t8); return result; } };
@Override public void failed(Throwable x) { if (failed != null) { failed.call(x); } } };
@Override public R call(T1 t1, T2 t2) { action.call(t1, t2); return result; } };
@Override public boolean headerComplete(Request request, Response response, HTTPOutputStream output, HTTPConnection connection) { if (headerComplete != null) { return headerComplete.call(request, response, output, connection); } else { return false; } }
/** * Converts an {@link Action4} to a function that calls the action and returns {@code null}. * * @param action the {@link Action4} to convert * @return a {@link Func4} that calls {@code action} and returns {@code null} */ public static <T1, T2, T3, T4> Func4<T1, T2, T3, T4, Void> toFunc(final Action4<T1, T2, T3, T4> action) { return toFunc(action, (Void) null); }
@Override public void succeeded() { if (succeeded != null) { succeeded.call(); } }
@Override public boolean messageComplete(Request request, Response response, HTTPOutputStream output, HTTPConnection connection) { if (messageComplete != null) { return messageComplete.call(request, response, output, connection); } else { return true; } }
/** * Converts an {@link Action3} to a function that calls the action and returns {@code null}. * * @param action the {@link Action3} to convert * @return a {@link Func3} that calls {@code action} and returns {@code null} */ public static <T1, T2, T3> Func3<T1, T2, T3, Void> toFunc(final Action3<T1, T2, T3> action) { return toFunc(action, (Void) null); }
/** * Converts an {@link Action9} to a function that calls the action and returns {@code null}. * * @param action the {@link Action9} to convert * @return a {@link Func9} that calls {@code action} and returns {@code null} */ public static <T1, T2, T3, T4, T5, T6, T7, T8, T9> Func9<T1, T2, T3, T4, T5, T6, T7, T8, T9, Void> toFunc( final Action9<T1, T2, T3, T4, T5, T6, T7, T8, T9> action) { return toFunc(action, (Void) null); }
/** * Converts an {@link ActionN} to a function that calls the action and returns {@code null}. * * @param action the {@link ActionN} to convert * @return a {@link FuncN} that calls {@code action} and returns {@code null} */ public static FuncN<Void> toFunc( final ActionN action) { return toFunc(action, (Void) null); }