Class AbstractSortStrategy

java.lang.Object
org.springframework.graphql.data.query.AbstractSortStrategy
All Implemented Interfaces:
SortStrategy

public abstract class AbstractSortStrategy extends Object implements SortStrategy
Convenient base class for a SortStrategy. Subclasses help to extract the list of sort properties and direction.
Since:
1.2.0
Author:
Rossen Stoyanchev
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.springframework.data.domain.Sort
    extract(graphql.schema.DataFetchingEnvironment environment)
    Return a Sort instance by extracting the sort information from GraphQL arguments, or Sort.unsorted() otherwise.
    protected abstract org.springframework.data.domain.Sort.Direction
    getDirection(graphql.schema.DataFetchingEnvironment environment)
    Return the sort direction to use, or null.
    protected abstract List<String>
    getProperties(graphql.schema.DataFetchingEnvironment environment)
    Return the sort properties to use, or an empty list if there are none.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AbstractSortStrategy

      public AbstractSortStrategy()
  • Method Details

    • extract

      public org.springframework.data.domain.Sort extract(graphql.schema.DataFetchingEnvironment environment)
      Description copied from interface: SortStrategy
      Return a Sort instance by extracting the sort information from GraphQL arguments, or Sort.unsorted() otherwise.
      Specified by:
      extract in interface SortStrategy
      Parameters:
      environment - the data fetching environment
    • getProperties

      protected abstract List<String> getProperties(graphql.schema.DataFetchingEnvironment environment)
      Return the sort properties to use, or an empty list if there are none.
      Parameters:
      environment - the data fetching environment for this operation
    • getDirection

      @Nullable protected abstract org.springframework.data.domain.Sort.Direction getDirection(graphql.schema.DataFetchingEnvironment environment)
      Return the sort direction to use, or null.
      Parameters:
      environment - the data fetching environment for this operation