Package org.apache.sling.graphql.api
Interface SlingDataFetcherEnvironment
-
@ProviderType public interface SlingDataFetcherEnvironmentProvides contextual information to the {#link SlingDataFetcher}
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <T> TgetArgument(String name)<T> TgetArgument(String name, T defaultValue)@Nullable Map<String,Object>getArguments()@Nullable org.apache.sling.api.resource.ResourcegetCurrentResource()@Nullable StringgetFetcherOptions()@Nullable StringgetFetcherSource()@Nullable ObjectgetParentObject()SelectionSetgetSelectionSet()
-
-
-
Method Detail
-
getParentObject
@Nullable @Nullable Object getParentObject()
- Returns:
- the parent object of the field that's being retrieved
-
getArguments
@Nullable @Nullable Map<String,Object> getArguments()
- Returns:
- the arguments passed to the GraphQL query
-
getArgument
@Nullable <T> T getArgument(String name)
- 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
@Nullable <T> T getArgument(String name, T defaultValue)
- 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
@Nullable @Nullable String getFetcherOptions()
- Returns:
- the options, if set by the schema directive
-
getFetcherSource
@Nullable @Nullable String getFetcherSource()
- Returns:
- the source, if set by the schema directive
-
getSelectionSet
SelectionSet getSelectionSet()
- Returns:
- the selectionSet, mandatory in a graphql query
-
-