Package org.apache.sling.graphql.api

# Interface SlingDataFetcherEnvironment

@ProviderType public interface SlingDataFetcherEnvironment
Provides contextual information to the {#link SlingDataFetcher}

## Method Summary

Modifier and Type
Method
Description
`<T> T`
`getArgument(String name)`
`<T> T`
`getArgument(String name, T defaultValue)`
`@Nullable Map<String,Object>`
`getArguments()`
`@Nullable org.apache.sling.api.resource.Resource`
`getCurrentResource()`
`@Nullable String`
`getFetcherOptions()`
`@Nullable String`
`getFetcherSource()`
`@Nullable Object`
`getParentObject()`
`SelectionSet`
`getSelectionSet()`

## Method Details

### 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 return
  `defaultValue` - 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