Class TrackingTokenUtils
java.lang.Object
org.axonframework.messaging.eventhandling.processing.streaming.token.TrackingTokenUtils
Utility methods to combine collections of
TrackingTokens.
Where TrackingToken.lowerBound(TrackingToken) and TrackingToken.upperBound(TrackingToken) combine two
tokens, these helpers reduce an arbitrary collection to a single token, ignoring null elements.
- Since:
- 5.3.0
- Author:
- Allard Buijze
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleancoversWhenUnwrapped(TrackingToken candidate, TrackingToken reference) Indicates whethercandidaterepresents a position at or beyondreference, comparing the rawunwrappedlower-bound andupper-boundpositions rather than the tokens directly.static TrackingTokenlowerBound(Collection<@Nullable TrackingToken> tokens) static @Nullable TrackingTokenupperBound(Collection<@Nullable TrackingToken> tokens)
-
Method Details
-
lowerBound
- Parameters:
tokens- the tokens to combine- Returns:
- the lower bound of the non-
nulltokens, orTrackingToken.FIRSTif there are none
-
upperBound
- Parameters:
tokens- the tokens to combine- Returns:
- the upper bound of the non-
nulltokens, ornullif there are none
-
coversWhenUnwrapped
Indicates whethercandidaterepresents a position at or beyondreference, comparing the rawunwrappedlower-bound andupper-boundpositions rather than the tokens directly.A wrapped token may describe a range, of which both ends must cover
referenceto count as an advance. An unwrapped end that is absent oncandidateis never an advance; absent onreferenceit leaves nothing to regress from.- Parameters:
candidate- the token whose position is testedreference- the token to compare against- Returns:
trueif both ends ofcandidatecover the matching ends ofreferenceonce unwrapped to their raw positions
-