Package graphql.relay
Class SimpleListConnection<T>
java.lang.Object
graphql.relay.SimpleListConnection<T>
- All Implemented Interfaces:
DataFetcher<Connection<T>>,TrivialDataFetcher<Connection<T>>
@PublicApi
public class SimpleListConnection<T>
extends Object
implements DataFetcher<Connection<T>>, TrivialDataFetcher<Connection<T>>
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSimpleListConnection(List<T> data) SimpleListConnection(List<T> data, String prefix) -
Method Summary
Modifier and TypeMethodDescriptionprivate StringcreateCursor(int offset) cursorForObjectInConnection(T object) find the object's cursor, or null if the object is not in this connection.private Connection<T> get(DataFetchingEnvironment environment) This is called by the graphql engine to fetch the value.private intgetOffsetFromCursor(String cursor, int defaultValue)
-
Field Details
-
DUMMY_CURSOR_PREFIX
- See Also:
-
prefix
-
data
-
-
Constructor Details
-
SimpleListConnection
-
SimpleListConnection
-
-
Method Details
-
buildEdges
-
get
Description copied from interface:DataFetcherThis is called by the graphql engine to fetch the value. TheDataFetchingEnvironmentis a composite context object that tells you all you need to know about how to fetch a data value in graphql type terms.- Specified by:
getin interfaceDataFetcher<T>- Parameters:
environment- this is the data fetching environment which contains all the context you need to fetch a value- Returns:
- a value of type T. May be wrapped in a
DataFetcherResult
-
emptyConnection
-
cursorForObjectInConnection
find the object's cursor, or null if the object is not in this connection.- Parameters:
object- the object in play- Returns:
- a connection cursor
-
getOffsetFromCursor
-
createCursor
-