Package graphql

Class ExecutionResultImpl

    • 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)
    • Method Detail

      • isDataPresent

        public boolean isDataPresent()
        Description copied from interface: ExecutionResult
        The 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 where ExecutionResult.getData() returns null. See : https://graphql.github.io/graphql-spec/June2018/#sec-Data
        Specified by:
        isDataPresent in interface ExecutionResult
        Returns:
        true if the entry "data" should be present in the result false otherwise
      • getErrors

        public java.util.List<GraphQLError> getErrors()
        Specified by:
        getErrors in interface ExecutionResult
        Returns:
        the errors that occurred during execution or empty list if there is none
      • getData

        public <T> T getData()
        Specified by:
        getData in interface ExecutionResult
        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:
        getExtensions in interface ExecutionResult
        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: ExecutionResult
        The 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 interpret ExecutionResult to 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:
        toSpecification in interface ExecutionResult
        Returns:
        a map of the result that strictly follows the spec
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object