Interface ConnectionAdapter

All Known Implementing Classes:
SliceConnectionAdapter, WindowConnectionAdapter

public interface ConnectionAdapter
Contract to adapt a container object for a window of elements from a larger result set to Connection.
Since:
1.2.0
Author:
Rossen Stoyanchev
  • Method Summary

    Modifier and Type
    Method
    Description
    cursorAt(Object container, int index)
    Return a cursor for the item at the given index.
    Create a composite ConnectionAdapter that checks which adapter supports a given Object container type and delegates to it.
    <T> Collection<T>
    getContent(Object container)
    Return the contained items as a List.
    boolean
    hasNext(Object container)
    Whether there are more pages after this one.
    boolean
    hasPrevious(Object container)
    Whether there are more pages before this one.
    boolean
    supports(Class<?> containerType)
    Whether the adapter supports the given Object container type.
  • Method Details

    • supports

      boolean supports(Class<?> containerType)
      Whether the adapter supports the given Object container type.
    • getContent

      <T> Collection<T> getContent(Object container)
      Return the contained items as a List.
    • hasPrevious

      boolean hasPrevious(Object container)
      Whether there are more pages before this one.
    • hasNext

      boolean hasNext(Object container)
      Whether there are more pages after this one.
    • cursorAt

      String cursorAt(Object container, int index)
      Return a cursor for the item at the given index.
    • from

      static ConnectionAdapter from(List<ConnectionAdapter> adapters)
      Create a composite ConnectionAdapter that checks which adapter supports a given Object container type and delegates to it.
      Parameters:
      adapters - the adapters to delegate to
      Returns:
      the composite adapter instance