Class OffsetPagedResult<T>

java.lang.Object
com.helixframework.db.pagination.OffsetPagedResult<T>
Type Parameters:
T - type of result
All Implemented Interfaces:
Iterable<T>

public class OffsetPagedResult<T> extends Object implements Iterable<T>
Offset paginated results collection.
  • Constructor Details

    • OffsetPagedResult

      public OffsetPagedResult()
  • Method Details

    • from

      public static <T> OffsetPagedResult<T> from(long limit, long offset, List<T> results)
      Creates an OffsetPagedResult object with the given limit, offset, and results.
      Type Parameters:
      T - the type of the result
      Parameters:
      limit - the maximum number of results in each page
      offset - the starting index of the results
      results - the list of results
      Returns:
      the OffsetPagedResult object
    • size

      public long size()
      Returns the size of the list of results.
      Returns:
      the size of the list of results, or 0 if the list is empty or null
    • getLimit

      public long getLimit()
      Returns the limit value.
      Returns:
      pagination limit
    • setLimit

      public void setLimit(long limit)
      Sets the limit value.
      Parameters:
      limit - the maximum number of results in each page
    • getOffset

      public long getOffset()
      Returns the offset value.
      Returns:
      the starting index of the results
    • setOffset

      public void setOffset(long offset)
      Sets the offset value.
      Parameters:
      offset - the starting index of the results
    • getResults

      public List<T> getResults()
      Returns the list of results.
      Returns:
      the list of results
    • setResults

      public void setResults(List<T> results)
      Sets the list of results.
      Parameters:
      results - the list of results to be set
    • iterator

      public Iterator<T> iterator()
      Specified by:
      iterator in interface Iterable<T>
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object