Class DefaultExecutionGraphQlResponse
java.lang.Object
org.springframework.graphql.support.AbstractGraphQlResponse
org.springframework.graphql.support.DefaultExecutionGraphQlResponse
- All Implemented Interfaces:
- ExecutionGraphQlResponse,- GraphQlResponse
- Direct Known Subclasses:
- RSocketGraphQlResponse,- WebGraphQlResponse
public class DefaultExecutionGraphQlResponse
extends AbstractGraphQlResponse
implements ExecutionGraphQlResponse
GraphQlResponse for server use that wraps the ExecutionResult
 returned from GraphQL and also exposes the actual
 ExecutionInput instance passed into it.- Since:
- 1.0.0
- Author:
- Rossen Stoyanchev
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classDefaultExecutionGraphQlResponse.Builder<B extends DefaultExecutionGraphQlResponse.Builder<B,R>, R extends ExecutionGraphQlResponse> Builder to transform the response'sExecutionResult.
- 
Constructor SummaryConstructorsModifierConstructorDescriptionDefaultExecutionGraphQlResponse(ExecutionInput input, ExecutionResult result) Constructor to create initial instance.protectedConstructor to re-wrap from transport specific subclass.
- 
Method SummaryModifier and TypeMethodDescription<T> TgetData()Return the data part of the response, ornullwhen the response is notvalid.Return errors included in the response.Return theExecutionInputthat was prepared through theExecutionGraphQlRequestand passed toGraphQL.Return theExecutionResultthat was returned from the invocation toGraphQL.Return implementor specific, protocol extensions, if any.booleanisValid()Whether the response is valid.toMap()Return a map representation of the response, formatted as required in the "Response" section of the GraphQL spec.toString()Methods inherited from class org.springframework.graphql.support.AbstractGraphQlResponsefieldMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.graphql.GraphQlResponsefield
- 
Constructor Details- 
DefaultExecutionGraphQlResponseConstructor to create initial instance.- Parameters:
- input- the execution input for this graphql operation
- result- the execution result for this graphql operation
 
- 
DefaultExecutionGraphQlResponseConstructor to re-wrap from transport specific subclass.- Parameters:
- response- the execution response
 
 
- 
- 
Method Details- 
getExecutionInputDescription copied from interface:ExecutionGraphQlResponseReturn theExecutionInputthat was prepared through theExecutionGraphQlRequestand passed toGraphQL.- Specified by:
- getExecutionInputin interface- ExecutionGraphQlResponse
 
- 
getExecutionResultDescription copied from interface:ExecutionGraphQlResponseReturn theExecutionResultthat was returned from the invocation toGraphQL.- Specified by:
- getExecutionResultin interface- ExecutionGraphQlResponse
 
- 
isValidpublic boolean isValid()Description copied from interface:GraphQlResponseWhether the response is valid. A response is invalid in one of the following two cases:- the response maphas no "data" entry indicating errors before execution, e.g. grammar parse and validation
- the "data" entry has a nullvalue indicating errors during execution that prevented a valid response
 A valid response has a "data" key with a non-nullvalue, but it may still be partial and have some fields set tonulldue to field errors.For more details, see section 7 "Response" in the GraphQL spec. - Specified by:
- isValidin interface- GraphQlResponse
 
- the 
- 
getDataDescription copied from interface:GraphQlResponseReturn the data part of the response, ornullwhen the response is notvalid.- Specified by:
- getDatain interface- GraphQlResponse
- Type Parameters:
- T- a map or a list
 
- 
getErrorsDescription copied from interface:GraphQlResponseReturn errors included in the response.A response that is not validcontains "request errors". Those are errors that apply to the request as a whole, and have an empty errorpath.A response that is valid may still be partial and contain "field errors". Those are errors associated with a specific field through their error path. - Specified by:
- getErrorsin interface- GraphQlResponse
 
- 
getExtensionsDescription copied from interface:GraphQlResponseReturn implementor specific, protocol extensions, if any.- Specified by:
- getExtensionsin interface- GraphQlResponse
 
- 
toMapDescription copied from interface:GraphQlResponseReturn a map representation of the response, formatted as required in the "Response" section of the GraphQL spec.- Specified by:
- toMapin interface- GraphQlResponse
 
- 
toString
 
-