Package org.apache.sling.graphql.api
Interface SlingDataFetcherEnvironment
@ProviderType
public interface SlingDataFetcherEnvironment
Provides contextual information to the {#link SlingDataFetcher}
-
Method Summary
Modifier and TypeMethodDescription<T> TgetArgument(String name) <T> TgetArgument(String name, T defaultValue) @Nullable org.apache.sling.api.resource.Resource@Nullable String@Nullable String@Nullable Object
-
Method Details
-
getParentObject
- Returns:
- the parent object of the field that's being retrieved
-
getArguments
- Returns:
- the arguments passed to the GraphQL query
-
getArgument
- Type Parameters:
T- the argument type- Parameters:
name- the name of the argument to return- Returns:
- a single argument, passed to the GraphQL query
-
getArgument
- Type Parameters:
T- the argument type- Parameters:
name- the name of the argument to returndefaultValue- the default value to return- Returns:
- a single argument, passed to the GraphQL query
-
getCurrentResource
@Nullable @Nullable org.apache.sling.api.resource.Resource getCurrentResource()- Returns:
- the current Sling resource
-
getFetcherOptions
- Returns:
- the options, if set by the schema directive
-
getFetcherSource
- Returns:
- the source, if set by the schema directive
-
getSelectionSet
SelectionSet getSelectionSet()- Returns:
- the selectionSet, mandatory in a graphql query
-