Class SliceConnectionAdapter

java.lang.Object
org.springframework.graphql.data.pagination.ConnectionAdapterSupport<org.springframework.data.domain.ScrollPosition>
org.springframework.graphql.data.query.SliceConnectionAdapter
All Implemented Interfaces:
ConnectionAdapter

public final class SliceConnectionAdapter extends ConnectionAdapterSupport<org.springframework.data.domain.ScrollPosition> implements ConnectionAdapter
Adapter for Slice to Connection.
Since:
1.2.0
Author:
Rossen Stoyanchev, Oliver Drotbohm
  • Constructor Details

    • SliceConnectionAdapter

      public SliceConnectionAdapter(CursorStrategy<org.springframework.data.domain.ScrollPosition> strategy)
      Constructor with the CursorStrategy to use to encode the ScrollPosition of page items.
      Parameters:
      strategy - the cursor strategy to use
  • Method Details

    • supports

      public boolean supports(Class<?> containerType)
      Description copied from interface: ConnectionAdapter
      Whether the adapter supports the given Object container type.
      Specified by:
      supports in interface ConnectionAdapter
      Parameters:
      containerType - the container type to check for support
    • getContent

      public <T> Collection<T> getContent(Object container)
      Description copied from interface: ConnectionAdapter
      Return the contained items as a List.
      Specified by:
      getContent in interface ConnectionAdapter
      Type Parameters:
      T - the type of objects in the collection
      Parameters:
      container - the container of elements
    • hasPrevious

      public boolean hasPrevious(Object container)
      Description copied from interface: ConnectionAdapter
      Whether there are more pages before this one.
      Specified by:
      hasPrevious in interface ConnectionAdapter
      Parameters:
      container - the container of elements
    • hasNext

      public boolean hasNext(Object container)
      Description copied from interface: ConnectionAdapter
      Whether there are more pages after this one.
      Specified by:
      hasNext in interface ConnectionAdapter
      Parameters:
      container - the container of elements
    • cursorAt

      public String cursorAt(Object container, int index)
      Description copied from interface: ConnectionAdapter
      Return a cursor for the item at the given index.
      Specified by:
      cursorAt in interface ConnectionAdapter
      Parameters:
      container - the container of elements
      index - the index of an element in the container