Package org.springframework.data.domain
Class OffsetScrollPosition
java.lang.Object
org.springframework.data.domain.OffsetScrollPosition
- All Implemented Interfaces:
ScrollPosition
A
ScrollPosition based on the offsets within query results.
An initial OffsetScrollPosition does not point to a specific element and is different to a position
{ScrollPosition.offset(long).
- Since:
- 3.1
- Author:
- Mark Paluch, Oliver Drotbohm, Christoph Strobl, Yanming Zhou
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.springframework.data.domain.ScrollPosition
ScrollPosition.Direction -
Method Summary
Modifier and TypeMethodDescriptionadvanceBy(long delta) Returns a newOffsetScrollPositionthat has been advanced by the given value.booleanlongThe zero or positive offset.inthashCode()booleanReturns whether the current scroll position is the initial one.Returns theposition functionstarting after the currentoffset.static IntFunction<OffsetScrollPosition>positionFunction(long startOffset) Returns aposition functionstarting atstartOffset.toString()
-
Method Details
-
positionFunction
Returns aposition functionstarting atstartOffset.- Parameters:
startOffset- the start offset to be used. Must not be negative.- Returns:
- the offset-based position function.
-
positionFunction
Returns theposition functionstarting after the currentoffset.- Returns:
- the offset-based position function.
- Since:
- 3.3
-
getOffset
public long getOffset()The zero or positive offset.An
initialposition does not define an offset and will raise an error.- Returns:
- the offset.
- Throws:
IllegalStateException- ifisInitial().
-
advanceBy
Returns a newOffsetScrollPositionthat has been advanced by the given value. Negative deltas will be constrained so that the new offset is at least zero.- Parameters:
delta- the value to advance the current offset by.- Returns:
- will never be null.
-
isInitial
public boolean isInitial()Description copied from interface:ScrollPositionReturns whether the current scroll position is the initial one.- Specified by:
isInitialin interfaceScrollPosition- Returns:
-
equals
-
hashCode
public int hashCode() -
toString
-