/** * Type-safe way to get the fifth object of this {@link Tuple}. * * @return The fifth object, cast to the correct type. */ @SuppressWarnings("unchecked") public T5 getT5() { return (T5) get(4); }
/** * Type-safe way to get the first object of this {@link Tuple}. * * @return The first object, cast to the correct type. */ @SuppressWarnings("unchecked") public T1 getT1() { return (T1) get(0); }
/** * Create a {@link Tuple2} with the given objects. * * @param t1 The first value in the tuple. * @param t2 The second value in the tuple. * @param <T1> The type of the first value. * @param <T2> The type of the second value. * @return The new {@link Tuple2}. */ public static <T1, T2> Tuple2<T1, T2> of(T1 t1, T2 t2) { return new Tuple2<T1, T2>(t1, t2); }
/** * Notify this server's consumers that the server has stopped. */ protected void notifyShutdown() { reactor.notify(shutdown.getT2(), selfEvent); }
@Override public TcpConnection<IN, OUT> consume(final Consumer<IN> consumer) { eventsReactor.on(read.getT1(), new Consumer<Event<IN>>() { @Override public void accept(Event<IN> ev) { consumer.accept(ev.getData()); } }); return this; }
@Override protected void flush() { ioChannel.write(Tuple.of(null, true)); }
/** * Create a {@link TupleN} with the given objects. * * @param t1 The first value in the tuple. * @param t2 The second value in the tuple. * @param t3 The third value in the tuple. * @param t4 The fourth value in the tuple. * @param t5 The fifth value in the tuple. * @param t6 The sixth value in the tuple. * @param t7 The seventh value in the tuple. * @param t8 The eighth value in the tuple. * @param tRest The rest of the values. * @param <T1> The type of the first value. * @param <T2> The type of the second value. * @param <T3> The type of the third value. * @param <T4> The type of the fourth value. * @param <T5> The type of the fifth value. * @param <T6> The type of the sixth value. * @param <T7> The type of the seventh value. * @param <TRest> The type of the last tuple. * @return The new {@link Tuple8}. */ public static <T1, T2, T3, T4, T5, T6, T7, T8, TRest extends Tuple> TupleN<T1, T2, T3, T4, T5, T6, T7, T8, TRest> of(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, Object... tRest) { return new TupleN<T1, T2, T3, T4, T5, T6, T7, T8, TRest>(t1, t2, t3, t4, t5, t6, t7, t8, new Tuple(tRest)); }
/** * Type-safe way to get the remaining objects of this {@link Tuple}. * * @return The remaining objects, as a Tuple. */ @SuppressWarnings("unchecked") public TRest getTRest() { return (TRest) get(8); }
/** * Type-safe way to get the fourth object of this {@link Tuple}. * * @return The fourth object, cast to the correct type. */ @SuppressWarnings("unchecked") public T4 getT4() { return (T4) get(3); }
/** * Type-safe way to get the third object of this {@link Tuple}. * * @return The third object, cast to the correct type. */ @SuppressWarnings("unchecked") public T3 getT3() { return (T3) get(2); }
/** * Create a {@link Tuple1} with the given object. * * @param t1 The first value in the tuple. * @param <T1> The type of the first value. * @return The new {@link Tuple1}. */ public static <T1> Tuple1<T1> of(T1 t1) { return new Tuple1<T1>(t1); }
/** * Type-safe way to get the eighth object of this {@link Tuple}. * * @return The eighth object, cast to the correct type. */ @SuppressWarnings("unchecked") public T8 getT8() { return (T8) get(7); }
/** * Type-safe way to get the second object of this {@link Tuple}. * * @return The second object, cast to the correct type. */ @SuppressWarnings("unchecked") public T2 getT2() { return (T2) get(1); }
/** * Type-safe way to get the sixth object of this {@link Tuple}. * * @return The sixth object, cast to the correct type. */ @SuppressWarnings("unchecked") public T6 getT6() { return (T6) get(5); }
/** * Type-safe way to get the seventh object of this {@link Tuple}. * * @return The seventh object, cast to the correct type. */ @SuppressWarnings("unchecked") public T7 getT7() { return (T7) get(6); }
/** * Create a {@link Tuple3} with the given objects. * * @param t1 The first value in the tuple. * @param t2 The second value in the tuple. * @param t3 The third value in the tuple. * @param <T1> The type of the first value. * @param <T2> The type of the second value. * @param <T3> The type of the third value. * @return The new {@link Tuple3}. */ public static <T1, T2, T3> Tuple3<T1, T2, T3> of(T1 t1, T2 t2, T3 t3) { return new Tuple3<T1, T2, T3>(t1, t2, t3); }
/** * Create a {@link Tuple4} with the given objects. * * @param t1 The first value in the tuple. * @param t2 The second value in the tuple. * @param t3 The third value in the tuple. * @param t4 The fourth value in the tuple. * @param <T1> The type of the first value. * @param <T2> The type of the second value. * @param <T3> The type of the third value. * @param <T4> The type of the fourth value. * @return The new {@link Tuple4}. */ public static <T1, T2, T3, T4> Tuple4<T1, T2, T3, T4> of(T1 t1, T2 t2, T3 t3, T4 t4) { return new Tuple4<T1, T2, T3, T4>(t1, t2, t3, t4); }
/** * Create a {@link Tuple5} with the given objects. * * @param t1 The first value in the tuple. * @param t2 The second value in the tuple. * @param t3 The third value in the tuple. * @param t4 The fourth value in the tuple. * @param t5 The fifth value in the tuple. * @param <T1> The type of the first value. * @param <T2> The type of the second value. * @param <T3> The type of the third value. * @param <T4> The type of the fourth value. * @param <T5> The type of the fifth value. * @return The new {@link Tuple5}. */ public static <T1, T2, T3, T4, T5> Tuple5<T1, T2, T3, T4, T5> of(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5) { return new Tuple5<T1, T2, T3, T4, T5>(t1, t2, t3, t4, t5); }
/** * Create a {@link Tuple6} with the given objects. * * @param t1 The first value in the tuple. * @param t2 The second value in the tuple. * @param t3 The third value in the tuple. * @param t4 The fourth value in the tuple. * @param t5 The fifth value in the tuple. * @param t6 The sixth value in the tuple. * @param <T1> The type of the first value. * @param <T2> The type of the second value. * @param <T3> The type of the third value. * @param <T4> The type of the fourth value. * @param <T5> The type of the fifth value. * @param <T6> The type of the sixth value. * @return The new {@link Tuple6}. */ public static <T1, T2, T3, T4, T5, T6> Tuple6<T1, T2, T3, T4, T5, T6> of(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6) { return new Tuple6<T1, T2, T3, T4, T5, T6>(t1, t2, t3, t4, t5, t6); }
@Override public void accept(Tuple tup) { cl.call(tup.toArray()); }