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() |
field
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
field
public DefaultExecutionGraphQlResponse(ExecutionInput input, ExecutionResult result)
protected DefaultExecutionGraphQlResponse(ExecutionGraphQlResponse response)
public ExecutionInput getExecutionInput()
ExecutionGraphQlResponse
ExecutionInput
that was prepared through the
ExecutionGraphQlRequest
and passed to GraphQL
.getExecutionInput
in interface ExecutionGraphQlResponse
public ExecutionResult getExecutionResult()
ExecutionGraphQlResponse
ExecutionResult
that was returned from the invocation
to GraphQL
.getExecutionResult
in interface ExecutionGraphQlResponse
public boolean isValid()
GraphQlResponse
response 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()
GraphQlResponse
null
when the response
is not valid
.getData
in interface GraphQlResponse
T
- a map or a listpublic List<ResponseError> getErrors()
GraphQlResponse
A 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 GraphQlResponse
public Map<Object,Object> getExtensions()
GraphQlResponse
getExtensions
in interface GraphQlResponse
public Map<String,Object> toMap()
GraphQlResponse
toMap
in interface GraphQlResponse