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 TypeMethodDescriptionReturn a cursor for the item at the given index.static ConnectionAdapterfrom(List<ConnectionAdapter> adapters) Create a compositeConnectionAdapterthat 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.booleanWhether there are more pages after this one.booleanhasPrevious(Object container) Whether there are more pages before this one.booleanWhether the adapter supports the given Object container type.
-
Method Details
-
supports
Whether the adapter supports the given Object container type.- Parameters:
containerType- the container type to check for support
-
getContent
Return the contained items as a List.- Type Parameters:
T- the type of objects in the collection- Parameters:
container- the container of elements
-
hasPrevious
Whether there are more pages before this one.- Parameters:
container- the container of elements
-
hasNext
Whether there are more pages after this one.- Parameters:
container- the container of elements
-
cursorAt
Return a cursor for the item at the given index.- Parameters:
container- the container of elementsindex- the index of an element in the container
-
from
Create a compositeConnectionAdapterthat 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
-