Class EncodingCursorStrategy<T>

java.lang.Object
org.springframework.graphql.data.pagination.EncodingCursorStrategy<T>
Type Parameters:
T - the type of position
All Implemented Interfaces:
CursorStrategy<T>

public final class EncodingCursorStrategy<T> extends Object implements CursorStrategy<T>
Decorator for a CursorStrategy that applies a CursorEncoder to the cursor String to make it opaque for external use.

To create an instance, use CursorStrategy.withEncoder(CursorStrategy, CursorEncoder).

Since:
1.2.0
Author:
Rossen Stoyanchev
  • Method Details

    • getDelegate

      public CursorStrategy<T> getDelegate()
      Return the decorated CursorStrategy.
    • getEncoder

      public CursorEncoder getEncoder()
      Return the configured CursorEncoder.
    • supports

      public boolean supports(Class<?> targetType)
      Description copied from interface: CursorStrategy
      Whether the strategy supports the given type of position Object.
      Specified by:
      supports in interface CursorStrategy<T>
      Parameters:
      targetType - the type of position to be checked
    • toCursor

      public String toCursor(T position)
      Description copied from interface: CursorStrategy
      Format the given position Object as a String cursor.
      Specified by:
      toCursor in interface CursorStrategy<T>
      Parameters:
      position - the position to serialize
      Returns:
      the created String cursor
    • fromCursor

      public T fromCursor(String cursor)
      Description copied from interface: CursorStrategy
      Parse the given String cursor into a position Object.
      Specified by:
      fromCursor in interface CursorStrategy<T>
      Parameters:
      cursor - the cursor to parse
      Returns:
      the position Object