Class ExecutionResultImpl
java.lang.Object
graphql.ExecutionResultImpl
- All Implemented Interfaces:
ExecutionResult
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Objectprivate final booleanprivate final List<GraphQLError> -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateExecutionResultImpl(boolean dataPresent, Object data, List<? extends GraphQLError> errors, Map<Object, Object> extensions) ExecutionResultImpl(GraphQLError error) ExecutionResultImpl(Object data, List<? extends GraphQLError> errors) ExecutionResultImpl(Object data, List<? extends GraphQLError> errors, Map<Object, Object> extensions) ExecutionResultImpl(List<? extends GraphQLError> errors) -
Method Summary
Modifier and TypeMethodDescriptionprivate ObjecterrorsToSpec(List<GraphQLError> errors) <T> TgetData()booleanThe graphql specification specifies: "If an error was encountered before execution begins, the data entry should not be present in the result.static ExecutionResultImpl.BuilderThe graphql specification says that result of a call should be a map that follows certain rules on what items should be present.toString()Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ExecutionResult
transform
-
Field Details
-
errors
-
data
-
extensions
-
dataPresent
private final transient boolean dataPresent
-
-
Constructor Details
-
ExecutionResultImpl
-
ExecutionResultImpl
-
ExecutionResultImpl
-
ExecutionResultImpl
-
ExecutionResultImpl
-
ExecutionResultImpl
-
-
Method Details
-
isDataPresent
public boolean isDataPresent()Description copied from interface:ExecutionResultThe graphql specification specifies: "If an error was encountered before execution begins, the data entry should not be present in the result. If an error was encountered during the execution that prevented a valid response, the data entry in the response should be null." This allows to distinguish between the cases whereExecutionResult.getData()returns null. See : https://graphql.github.io/graphql-spec/June2018/#sec-Data- Specified by:
isDataPresentin interfaceExecutionResult- Returns:
trueif the entry "data" should be present in the resultfalseotherwise
-
getErrors
- Specified by:
getErrorsin interfaceExecutionResult- Returns:
- the errors that occurred during execution or empty list if there is none
-
getData
public <T> T getData()- Specified by:
getDatain interfaceExecutionResult- Type Parameters:
T- allows type coercion- Returns:
- the data in the result or null if there is none
-
getExtensions
- Specified by:
getExtensionsin interfaceExecutionResult- Returns:
- a map of extensions or null if there are none
-
toSpecification
Description copied from interface:ExecutionResultThe graphql specification says that result of a call should be a map that follows certain rules on what items should be present. Certain JSON serializers may or may interpretExecutionResultto spec, so this method is provided to produce a map that strictly follows the specification. See : https://spec.graphql.org/October2021/#sec-Response-Format- Specified by:
toSpecificationin interfaceExecutionResult- Returns:
- a map of the result that strictly follows the spec
-
errorsToSpec
-
toString
-
newExecutionResult
-