Package graphql

Class TypeResolutionEnvironment

java.lang.Object
graphql.TypeResolutionEnvironment

@PublicApi @NullMarked public class TypeResolutionEnvironment extends Object
This is passed to a TypeResolver to help with object type resolution.

See TypeResolver.getType(graphql.TypeResolutionEnvironment) for how this is used

  • Constructor Details

  • Method Details

    • getObject

      public <T> @Nullable T getObject()
      You will be passed the specific source object that needs to be resolved into a concrete graphql object type
      Type Parameters:
      T - you decide what type it is
      Returns:
      the object that needs to be resolved into a specific graphql object type
    • getArguments

      public Map<String,Object> getArguments()
      Returns:
      the runtime arguments to this the graphql field
    • getField

      public MergedField getField()
      Returns:
      the graphql field in question
    • getFieldType

      public GraphQLType getFieldType()
      Returns:
      the type of the graphql field, which still be either a GraphQLUnionType or a GraphQLInterfaceType
    • getSchema

      public GraphQLSchema getSchema()
      Returns:
      the graphql schema in question
    • getContext

      @Deprecated(since="2021-12-27") public <T> @Nullable T getContext()
      Deprecated.
      Returns the context object set in via ExecutionInput.getContext()
      Type Parameters:
      T - the type to cast the result to
      Returns:
      the context object
    • getGraphQLContext

      public GraphQLContext getGraphQLContext()
      Returns:
      the GraphQLContext object set in via ExecutionInput.getGraphQLContext()
    • getLocalContext

      public <T> @Nullable T getLocalContext()
      Returns the local context object set in via DataFetcherResult.getLocalContext()
      Type Parameters:
      T - the type to cast the result to
      Returns:
      the local context object
    • getSelectionSet

      public DataFetchingFieldSelectionSet getSelectionSet()
      Returns:
      the DataFetchingFieldSelectionSet for the current field fetch that needs type resolution