@Test void testMergePosition() { MergedTrackingToken testSubject = new MergedTrackingToken(new MergedTrackingToken(token(1), token(3)), token(5)); assertTrue(MergedTrackingToken.mergePosition(testSubject).isPresent()); assertEquals(MergedTrackingToken.mergePosition(testSubject).getAsLong(), 5); }
public static OptionalLong mergePosition(TrackingToken trackingToken) { return WrappedToken.unwrap(trackingToken, MergedTrackingToken.class) .map(m -> m.mergePosition()) .filter(p -> p != Long.MIN_VALUE) .map(OptionalLong::of) .orElse(OptionalLong.empty()); }
MergedTrackingToken implements TrackingToken, Serializable, WrappedToken { public static OptionalLong mergePosition(TrackingToken trackingToken) { return WrappedToken.unwrap(trackingToken, MergedTrackingToken.class) .map(m -> m.mergePosition()) .filter(p -> p != Long.MIN_VALUE) .map(OptionalLong::of) .orElse(OptionalLong.empty()); } }
MergedTrackingToken implements TrackingToken, Serializable, WrappedToken { public static OptionalLong mergePosition(TrackingToken trackingToken) { return WrappedToken.unwrap(trackingToken, MergedTrackingToken.class) .map(m -> m.mergePosition()) .filter(p -> p != Long.MIN_VALUE) .map(OptionalLong::of) .orElse(OptionalLong.empty()); } @JsonCreator @ConstructorProperties({"lowerSegmentToken", "upperSegmentToken"})  MergedTrackingToken(
            @JsonProperty("lowerSegmentToken") TrackingToken lowerSegmentToken,
            @JsonProperty("upperSegmentToken") TrackingToken upperSegmentToken); protected  MergedTrackingToken(TrackingToken lowerSegmentToken, TrackingToken upperSegmentToken,
                                  boolean lowerSegmentAdvanced, boolean upperSegmentAdvanced); }
MergedTrackingToken implements TrackingToken, Serializable, WrappedToken { public static OptionalLong mergePosition(TrackingToken trackingToken) { return WrappedToken.unwrap(trackingToken, MergedTrackingToken.class) .map(m -> m.mergePosition()) .filter(p -> p != Long.MIN_VALUE) .map(OptionalLong::of) .orElse(OptionalLong.empty()); } @JsonCreator @ConstructorProperties({"lowerSegmentToken", "upperSegmentToken"})  MergedTrackingToken(
            @JsonProperty("lowerSegmentToken") TrackingToken lowerSegmentToken,
            @JsonProperty("upperSegmentToken") TrackingToken upperSegmentToken); protected  MergedTrackingToken(TrackingToken lowerSegmentToken, TrackingToken upperSegmentToken,
                                  boolean lowerSegmentAdvanced, boolean upperSegmentAdvanced); static boolean isMergeInProgress(TrackingToken trackingToken); static OptionalLong mergePosition(TrackingToken trackingToken); @Override TrackingToken lowerBound(TrackingToken other); @Override OptionalLong position(); @Override TrackingToken upperBound(TrackingToken other); @Override boolean covers(TrackingToken other); @Override TrackingToken advancedTo(TrackingToken newToken); @Override Optional<R> unwrap(Class<R> tokenType); @Override TrackingToken lowerBound(); @Override TrackingToken upperBound(); @JsonGetter("lowerSegmentToken") @JsonTypeInfo(use = JsonTypeInfo.Id.MINIMAL_CLASS) TrackingToken lowerSegmentToken(); @JsonGetter("upperSegmentToken") @JsonTypeInfo(use = JsonTypeInfo.Id.MINIMAL_CLASS) TrackingToken upperSegmentToken(); @JsonIgnore boolean isLowerSegmentAdvanced(); @JsonIgnore boolean isUpperSegmentAdvanced(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); }
MergedTrackingToken implements TrackingToken, Serializable, WrappedToken { public static OptionalLong mergePosition(TrackingToken trackingToken) { return WrappedToken.unwrap(trackingToken, MergedTrackingToken.class) .map(m -> m.mergePosition()) .filter(p -> p != Long.MIN_VALUE) .map(OptionalLong::of) .orElse(OptionalLong.empty()); } @JsonCreator @ConstructorProperties({"lowerSegmentToken", "upperSegmentToken"})  MergedTrackingToken(
            @JsonProperty("lowerSegmentToken") TrackingToken lowerSegmentToken,
            @JsonProperty("upperSegmentToken") TrackingToken upperSegmentToken); protected  MergedTrackingToken(TrackingToken lowerSegmentToken, TrackingToken upperSegmentToken,
                                  boolean lowerSegmentAdvanced, boolean upperSegmentAdvanced); static boolean isMergeInProgress(TrackingToken trackingToken); static OptionalLong mergePosition(TrackingToken trackingToken); @Override TrackingToken lowerBound(TrackingToken other); @Override OptionalLong position(); @Override TrackingToken upperBound(TrackingToken other); @Override boolean covers(TrackingToken other); @Override TrackingToken advancedTo(TrackingToken newToken); @Override Optional<R> unwrap(Class<R> tokenType); @Override TrackingToken lowerBound(); @Override TrackingToken upperBound(); @JsonGetter("lowerSegmentToken") @JsonTypeInfo(use = JsonTypeInfo.Id.MINIMAL_CLASS) TrackingToken lowerSegmentToken(); @JsonGetter("upperSegmentToken") @JsonTypeInfo(use = JsonTypeInfo.Id.MINIMAL_CLASS) TrackingToken upperSegmentToken(); @JsonIgnore boolean isLowerSegmentAdvanced(); @JsonIgnore boolean isUpperSegmentAdvanced(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }