public interface WrappedToken extends TrackingToken
Modifier and Type | Method and Description |
---|---|
static TrackingToken |
advance(TrackingToken base,
TrackingToken target)
|
TrackingToken |
advancedTo(TrackingToken newToken)
Advance this token to the given
newToken . |
TrackingToken |
lowerBound()
Returns the token representing the current position in the stream.
|
<R extends TrackingToken> |
unwrap(Class<R> tokenType)
Retrieve a token of given
tokenType if it is wrapped by this token. |
static <R extends TrackingToken> |
unwrap(TrackingToken token,
Class<R> tokenType)
Unwrap the given
token until a token of given tokenType is exposed. |
static TrackingToken |
unwrapLowerBound(TrackingToken token)
Extracts a raw token describing the current processing position of the given
token . |
static TrackingToken |
unwrapUpperBound(TrackingToken token)
Extracts a raw token describing the current processing position of the given
token . |
TrackingToken |
upperBound()
Returns the token representing the furthest position in the stream described by this token.
|
covers, lowerBound, position, upperBound
static TrackingToken unwrapLowerBound(TrackingToken token)
token
. If the given token is
a wrapped token, it will be unwrapped until the raw token (as received from the event stream) is reached.
The returned token represents the minimal position described by the given token (which may express a range)
token
- The token to unwrapstatic TrackingToken unwrapUpperBound(TrackingToken token)
token
. If the given token is
a wrapped token, it will be unwrapped until the raw token (as received from the event stream) is reached.
The returned token represents the furthest position described by the given token (which may express a range)
token
- The token to unwrapstatic <R extends TrackingToken> Optional<R> unwrap(TrackingToken token, Class<R> tokenType)
token
until a token of given tokenType
is exposed. Returns an empty optional if
the given token
is not a WrappedToken instance, or if it does not wrap a token of expected tokenType
.R
- The generic type of the token to revealtoken
- The token to unwraptokenType
- The type of token to revealstatic TrackingToken advance(TrackingToken base, TrackingToken target)
base
TrackingToken
to the target
. This method will return the target
as is if the base
is not an implementation of a WrappedToken
. If it is a WrappedToken
, it will invoke advancedTo(TrackingToken)
on the base
, using the target
.base
- the TrackingToken
to validate if it's a WrappedToken
which can be advancedTo(TrackingToken)
target
- the TrackingToken
to advance the given base
totarget
if base
does not implement WrappedToken
, otherwise the result of
invoking advancedTo(TrackingToken)
on the base
using the target
TrackingToken advancedTo(TrackingToken newToken)
newToken
.newToken
- The token representing the position to advance toTrackingToken lowerBound()
TrackingToken upperBound()
<R extends TrackingToken> Optional<R> unwrap(Class<R> tokenType)
tokenType
if it is wrapped by this token.R
- The generic type of the token to unwrap totokenType
- The type of token to unwrap toCopyright © 2010–2022. All rights reserved.