Read
- Type of objects tested by this Predicate
.public static final class NettyConnection.TerminalPredicate<Read>
extends java.lang.Object
implements java.util.function.Predicate<Read>
Predicate
to detect terminal message in a stream as returned by NettyConnection.read()
.
Use replaceCurrent(Predicate)
for replacing the current Predicate
and
discardIfCurrent(Predicate)
to revert back to the original Predicate
.
If a dynamic predicate (as set by replaceCurrent(Predicate)
terminates the stream,
this will automatically revert to the original Predicate
as done by calling
discardIfCurrent(Predicate)
.
Constructor and Description |
---|
TerminalPredicate(java.util.function.Predicate<Read> original)
New instance.
|
Modifier and Type | Method and Description |
---|---|
boolean |
discardIfCurrent(java.util.function.Predicate<Read> current)
Discards the current
Predicate (if same as passed current ) and sets current as
the original Predicate . |
void |
replaceCurrent(java.util.function.Predicate<Read> next)
Sets current
Predicate to next . |
boolean |
test(Read read) |
public TerminalPredicate(java.util.function.Predicate<Read> original)
original
- Predicate
. This is the Predicate
that will be set as current after
discardIfCurrent(Predicate)
is called.public void replaceCurrent(java.util.function.Predicate<Read> next)
Predicate
to next
.next
- Predicate
to set as current.public boolean discardIfCurrent(java.util.function.Predicate<Read> current)
Predicate
(if same as passed current
) and sets current as
the original Predicate
.current
- Predicate
to discard if current.true
if the predicate was discarded.