Package graphql

Interface ExecutionResult

    • Method Detail

      • getErrors

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

        <T> T getData()
        Type Parameters:
        T - allows type coercion
        Returns:
        the data in the result or null if there is none
      • isDataPresent

        boolean isDataPresent()
        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 getData() returns null. See : https://graphql.github.io/graphql-spec/June2018/#sec-Data
        Returns:
        true if the entry "data" should be present in the result false otherwise
      • getExtensions

        java.util.Map<java.lang.Object,​java.lang.Object> getExtensions()
        Returns:
        a map of extensions or null if there are none
      • toSpecification

        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. 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
        Returns:
        a map of the result that strictly follows the spec
      • transform

        default ExecutionResult transform​(java.util.function.Consumer<ExecutionResult.Builder<?>> builderConsumer)
        This helps you transform the current ExecutionResult object into another one by starting a builder with all the current values and allows you to transform it how you want.
        Parameters:
        builderConsumer - the consumer code that will be given a builder to transform
        Returns:
        a new ExecutionResult object based on calling build on that builder
      • newExecutionResult

        static ExecutionResult.Builder<?> newExecutionResult()
        Returns:
        a builder that allows you to build a new execution result