Package org.apache.sling.graphql.helpers
Class GenericConnection<T>
- java.lang.Object
-
- org.apache.sling.graphql.helpers.GenericConnection<T>
-
- All Implemented Interfaces:
Connection<T>
,PageInfo
@ConsumerType public final class GenericConnection<T> extends Object implements Connection<T>, PageInfo
As per https://relay.dev/graphql/connections.htm a "connection" is a page of results for a paginated query. Use theGenericConnection.Builder
class to build a Connection that outputs the supplied data, optionally sliced based on a "start after" cursor and a limit on the number of items output.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
GenericConnection.Builder<T>
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_LIMIT
static int
MAX_LIMIT
We might make this configurable but for now let's stay on the safe side
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull Iterable<Edge<T>>
getEdges()
@NotNull Cursor
getEndCursor()
@NotNull PageInfo
getPageInfo()
@NotNull Cursor
getStartCursor()
boolean
isHasNextPage()
boolean
isHasPreviousPage()
-
-
-
Field Detail
-
DEFAULT_LIMIT
public static final int DEFAULT_LIMIT
- See Also:
- Constant Field Values
-
MAX_LIMIT
public static final int MAX_LIMIT
We might make this configurable but for now let's stay on the safe side- See Also:
- Constant Field Values
-
-
Method Detail
-
getEdges
@NotNull public @NotNull Iterable<Edge<T>> getEdges()
- Specified by:
getEdges
in interfaceConnection<T>
-
getPageInfo
@NotNull public @NotNull PageInfo getPageInfo()
- Specified by:
getPageInfo
in interfaceConnection<T>
-
getStartCursor
@NotNull public @NotNull Cursor getStartCursor()
- Specified by:
getStartCursor
in interfacePageInfo
-
getEndCursor
@NotNull public @NotNull Cursor getEndCursor()
- Specified by:
getEndCursor
in interfacePageInfo
-
isHasPreviousPage
public boolean isHasPreviousPage()
- Specified by:
isHasPreviousPage
in interfacePageInfo
-
isHasNextPage
public boolean isHasNextPage()
- Specified by:
isHasNextPage
in interfacePageInfo
-
-