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.| Modifier and Type | Class and Description |
|---|---|
static class |
DefaultExecutionGraphQlResponse.Builder<B extends DefaultExecutionGraphQlResponse.Builder<B,R>,R extends ExecutionGraphQlResponse>
Builder to transform the response's
ExecutionResult. |
| Modifier | Constructor and Description |
|---|---|
protected |
DefaultExecutionGraphQlResponse(ExecutionGraphQlResponse response)
Constructor to re-wrap from transport specific subclass.
|
|
DefaultExecutionGraphQlResponse(ExecutionInput input,
ExecutionResult result)
Constructor to create initial instance.
|
| Modifier and Type | Method and Description |
|---|---|
<T> T |
getData()
Return the data part of the response, or
null when the response
is not valid. |
List<ResponseError> |
getErrors()
Return errors included in the response.
|
ExecutionInput |
getExecutionInput()
Return the
ExecutionInput that was prepared through the
ExecutionGraphQlRequest and passed to GraphQL. |
ExecutionResult |
getExecutionResult()
Return the
ExecutionResult that was returned from the invocation
to GraphQL. |
Map<Object,Object> |
getExtensions()
Return implementor specific, protocol extensions, if any.
|
boolean |
isValid()
Whether the response is valid.
|
Map<String,Object> |
toMap()
Return a map representation of the response, formatted as required in the
"Response" section of the GraphQL spec.
|
String |
toString() |
fieldclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitfieldpublic DefaultExecutionGraphQlResponse(ExecutionInput input, ExecutionResult result)
protected DefaultExecutionGraphQlResponse(ExecutionGraphQlResponse response)
public ExecutionInput getExecutionInput()
ExecutionGraphQlResponseExecutionInput that was prepared through the
ExecutionGraphQlRequest and passed to GraphQL.getExecutionInput in interface ExecutionGraphQlResponsepublic ExecutionResult getExecutionResult()
ExecutionGraphQlResponseExecutionResult that was returned from the invocation
to GraphQL.getExecutionResult in interface ExecutionGraphQlResponsepublic boolean isValid()
GraphQlResponseresponse map has no "data" entry indicating
errors before execution, e.g. grammar parse and validation
null value indicating errors during
execution that prevented a valid response
A valid response has a "data" key with a non-null value, but
it may still be partial and have some fields set to null due to
field errors.
For more details, see section 7 "Response" in the GraphQL spec.
isValid in interface GraphQlResponse@Nullable public <T> T getData()
GraphQlResponsenull when the response
is not valid.getData in interface GraphQlResponseT - a map or a listpublic List<ResponseError> getErrors()
GraphQlResponseA response that is not valid contains "request
errors". Those are errors that apply to the request as a whole, and have
an empty error path.
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.
getErrors in interface GraphQlResponsepublic Map<Object,Object> getExtensions()
GraphQlResponsegetExtensions in interface GraphQlResponsepublic Map<String,Object> toMap()
GraphQlResponsetoMap in interface GraphQlResponse