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 newOffsetScrollPosition
that has been advanced by the given value.boolean
long
The zero or positive offset.int
hashCode()
boolean
Returns whether the current scroll position is the initial one.Returns theposition function
starting after the currentoffset
.static IntFunction<OffsetScrollPosition>
positionFunction
(long startOffset) Returns aposition function
starting atstartOffset
.toString()
-
Method Details
-
positionFunction
Returns aposition function
starting atstartOffset
.- Parameters:
startOffset
- the start offset to be used. Must not be negative.- Returns:
- the offset-based position function.
-
positionFunction
Returns theposition function
starting after the currentoffset
.- Returns:
- the offset-based position function.
- Since:
- 3.3
-
getOffset
public long getOffset()The zero or positive offset.An
initial
position does not define an offset and will raise an error.- Returns:
- the offset.
- Throws:
IllegalStateException
- ifisInitial()
.
-
advanceBy
Returns a newOffsetScrollPosition
that 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:ScrollPosition
Returns whether the current scroll position is the initial one.- Specified by:
isInitial
in interfaceScrollPosition
- Returns:
-
equals
-
hashCode
public int hashCode() -
toString
-