Class DefaultConnection<T>

java.lang.Object
graphql.relay.DefaultConnection<T>
All Implemented Interfaces:
Connection<T>

@PublicApi @NullMarked public class DefaultConnection<T> extends Object implements Connection<T>
A default implementation of Connection
  • Constructor Details

    • DefaultConnection

      public DefaultConnection(List<Edge<T>> edges, PageInfo pageInfo)
      A connection consists of a list of edges and page info
      Parameters:
      edges - a non null list of edges
      pageInfo - a non null page info
      Throws:
      IllegalArgumentException - if edges or page info is null. use Collections.emptyList() for empty edges.
  • Method Details

    • getEdges

      public List<Edge<T>> getEdges()
      Specified by:
      getEdges in interface Connection<T>
      Returns:
      a list of Edges that contain a node of data and its cursor. Can be null as defined in the spec.
    • getPageInfo

      public PageInfo getPageInfo()
      Specified by:
      getPageInfo in interface Connection<T>
      Returns:
      PageInfo pagination data about that list of edges. Not nullable by definition in the spec.
    • equals

      public boolean equals(@Nullable Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object