Class OffsetTracker<ProgressParamT extends java.lang.Number>

  • Type Parameters:
    ProgressParamT - The numeric type to use for offset values (e.g., Integer, Long)
    All Implemented Interfaces:
    ProgressTrackerStrategy<ProgressParamT>

    public class OffsetTracker<ProgressParamT extends java.lang.Number>
    extends java.lang.Object
    implements ProgressTrackerStrategy<ProgressParamT>
    Handles pagination based on the number of results in each response. This tracker is suitable for APIs that return a count of items in each response and use that to determine if there are more pages.
    • Constructor Summary

      Constructors 
      Constructor Description
      OffsetTracker​(java.lang.String resultSizeExpression, java.lang.Class<ProgressParamT> offsetType, long initialOffset, long minItems)
      Creates a new OffsetTracker with a specified initial offset.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean advance​(com.jayway.jsonpath.ReadContext respJson)
      Process the response and update pagination state.
      ProgressParamT getPosition()
      Get the current progression value to use in the next request.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • OffsetTracker

        public OffsetTracker​(java.lang.String resultSizeExpression,
                             java.lang.Class<ProgressParamT> offsetType,
                             long initialOffset,
                             long minItems)
        Creates a new OffsetTracker with a specified initial offset.
        Parameters:
        resultSizeExpression - The JsonPath expression to extract result count
        offsetType - The class of the numeric type to use (e.g., Integer.class, Long.class)
        initialOffset - Initial offset value to start pagination from
        minItems - Minimum number of items required to continue pagination
    • Method Detail

      • advance

        public boolean advance​(com.jayway.jsonpath.ReadContext respJson)
        Description copied from interface: ProgressTrackerStrategy
        Process the response and update pagination state. This method should: 1. Extract pagination metadata from the response 2. Update internal state based on the metadata 3. Return true if there are more pages to fetch, false otherwise
        Specified by:
        advance in interface ProgressTrackerStrategy<ProgressParamT extends java.lang.Number>
        Parameters:
        respJson - The JSON response to process
        Returns:
        true if there are more pages to fetch, false otherwise