Class CursorTracker<ProgressParamT>
- java.lang.Object
-
- com.stackone.stackone_client_java.utils.pagination.CursorTracker<ProgressParamT>
-
- Type Parameters:
ProgressParamT- The type of the cursor value
- All Implemented Interfaces:
ProgressTrackerStrategy<ProgressParamT>
public class CursorTracker<ProgressParamT> extends java.lang.Object implements ProgressTrackerStrategy<ProgressParamT>
Handles pagination using cursor values from responses. This tracker is suitable for APIs that return a cursor value in each response that should be used to fetch the next page.
-
-
Constructor Summary
Constructors Constructor Description CursorTracker(java.lang.String cursorExpression, java.lang.Class<ProgressParamT> cursorType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadvance(com.jayway.jsonpath.ReadContext respJson)Process the response and update pagination state.ProgressParamTgetPosition()Get the current progression value to use in the next request.
-
-
-
Constructor Detail
-
CursorTracker
public CursorTracker(java.lang.String cursorExpression, java.lang.Class<ProgressParamT> cursorType)
-
-
Method Detail
-
advance
public boolean advance(com.jayway.jsonpath.ReadContext respJson)
Description copied from interface:ProgressTrackerStrategyProcess 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:
advancein interfaceProgressTrackerStrategy<ProgressParamT>- Parameters:
respJson- The JSON response to process- Returns:
- true if there are more pages to fetch, false otherwise
-
getPosition
public ProgressParamT getPosition()
Description copied from interface:ProgressTrackerStrategyGet the current progression value to use in the next request. This value will be used to modify the request for the next page.- Specified by:
getPositionin interfaceProgressTrackerStrategy<ProgressParamT>- Returns:
- The current progression value
-
-