T
- The type to be consumed by the consumers.public class JkConsumers<T>
extends java.lang.Object
implements java.util.function.Consumer<T>
Consumer
. From this object you can replace the underlying Runnable
or
chain it with other ones.Modifier and Type | Method and Description |
---|---|
void |
accept(T t) |
JkConsumers<T> |
append(java.util.function.Consumer<T> consumer)
Appends the specified consumer to the consumer chain.
|
JkConsumers<T> |
append(JkConsumers other)
Appends the specified
JkConsumers instance to the current chain of consumers. |
JkConsumers<T> |
append(java.lang.String name,
java.util.function.Consumer<T> consumer)
Appends the specified consumer, with the specified name, to the consumer chain.
|
java.util.List<java.lang.String> |
getConsumerNames()
Returns the name of the
Runnable s, in the order of execution chain. |
boolean |
isEmpty() |
static <T> JkConsumers<T> |
of()
Creates a
JkConsumers delegating to the single specified Consumer . |
JkConsumers<T> |
prepend(java.util.function.Consumer<T> consumer)
Chains this underlying
Consumer with the specified one. |
java.util.Map<java.lang.String,java.util.function.Consumer<T>> |
toMap() |
java.lang.String |
toString() |
public static <T> JkConsumers<T> of()
JkConsumers
delegating to the single specified Consumer
.public JkConsumers<T> append(java.util.function.Consumer<T> consumer)
public JkConsumers<T> append(java.lang.String name, java.util.function.Consumer<T> consumer)
public JkConsumers<T> append(JkConsumers other)
JkConsumers
instance to the current chain of consumers.
The consumers from the provided other
instance are added to the end of the existing chain.public JkConsumers<T> prepend(java.util.function.Consumer<T> consumer)
Consumer
with the specified one. The specified element will
be executed at the beginning.public java.util.List<java.lang.String> getConsumerNames()
Runnable
s, in the order of execution chain.public java.lang.String toString()
toString
in class java.lang.Object
public boolean isEmpty()
public java.util.Map<java.lang.String,java.util.function.Consumer<T>> toMap()