Class OffsetScrollPosition

java.lang.Object
org.springframework.data.domain.OffsetScrollPosition
All Implemented Interfaces:
ScrollPosition

public final class OffsetScrollPosition extends Object implements ScrollPosition
A ScrollPosition based on the offsets within query results.
Since:
3.1
Author:
Mark Paluch, Oliver Drotbohm
  • Method Details

    • positionFunction

      public static IntFunction<OffsetScrollPosition> positionFunction(long startOffset)
      Returns the position function to calculate.
      Parameters:
      startOffset - the start offset to be used. Must not be negative.
      Returns:
      the offset-based position function.
    • getOffset

      public long getOffset()
      The zero or positive offset.
      Returns:
      the offset.
    • advanceBy

      public OffsetScrollPosition advanceBy(long delta)
      Returns a new OffsetScrollPosition 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 interface ScrollPosition
      Returns:
    • equals

      public boolean equals(@Nullable Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object