Package graphql
Class ExecutionResultImpl
- java.lang.Object
-
- graphql.ExecutionResultImpl
-
- All Implemented Interfaces:
ExecutionResult
- Direct Known Subclasses:
IncrementalExecutionResultImpl
public class ExecutionResultImpl extends java.lang.Object implements ExecutionResult
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classExecutionResultImpl.Builder<T extends ExecutionResultImpl.Builder<T>>
-
Constructor Summary
Constructors Constructor Description ExecutionResultImpl(ExecutionResultImpl other)ExecutionResultImpl(ExecutionResultImpl.Builder<T> builder)ExecutionResultImpl(GraphQLError error)ExecutionResultImpl(java.lang.Object data, java.util.List<? extends GraphQLError> errors)ExecutionResultImpl(java.lang.Object data, java.util.List<? extends GraphQLError> errors, java.util.Map<java.lang.Object,java.lang.Object> extensions)ExecutionResultImpl(java.util.List<? extends GraphQLError> errors)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> TgetData()java.util.List<GraphQLError>getErrors()java.util.Map<java.lang.Object,java.lang.Object>getExtensions()booleanisDataPresent()The graphql specification specifies: "If an error was encountered before execution begins, the data entry should not be present in the result.static <T extends ExecutionResultImpl.Builder<T>>
ExecutionResultImpl.Builder<T>newExecutionResult()java.util.Map<java.lang.String,java.lang.Object>toSpecification()The graphql specification says that result of a call should be a map that follows certain rules on what items should be present.java.lang.StringtoString()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface graphql.ExecutionResult
transform
-
-
-
-
Constructor Detail
-
ExecutionResultImpl
public ExecutionResultImpl(GraphQLError error)
-
ExecutionResultImpl
public ExecutionResultImpl(java.util.List<? extends GraphQLError> errors)
-
ExecutionResultImpl
public ExecutionResultImpl(java.lang.Object data, java.util.List<? extends GraphQLError> errors)
-
ExecutionResultImpl
public ExecutionResultImpl(java.lang.Object data, java.util.List<? extends GraphQLError> errors, java.util.Map<java.lang.Object,java.lang.Object> extensions)
-
ExecutionResultImpl
public ExecutionResultImpl(ExecutionResultImpl other)
-
ExecutionResultImpl
public ExecutionResultImpl(ExecutionResultImpl.Builder<T> builder)
-
-
Method Detail
-
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
public java.util.List<GraphQLError> 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
public java.util.Map<java.lang.Object,java.lang.Object> getExtensions()
- Specified by:
getExtensionsin interfaceExecutionResult- Returns:
- a map of extensions or null if there are none
-
toSpecification
public java.util.Map<java.lang.String,java.lang.Object> 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
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
newExecutionResult
public static <T extends ExecutionResultImpl.Builder<T>> ExecutionResultImpl.Builder<T> newExecutionResult()
- Returns:
- a builder that allows you to build a new execution result
-
-