Interface Response


  • public interface Response
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      jakarta.json.JsonObject getData()
      The 'data' object contained in the response.
      List<GraphQLError> getErrors()
      List of errors contained in this response.
      jakarta.json.JsonObject getExtensions()
      List of user-made extensions contained in this response.
      <T> List<T> getList​(Class<T> dataType, String rootField)
      Transform the contents of the `rootField` from this response into a list of objects of the requested type.
      <T> T getObject​(Class<T> dataType, String rootField)
      Transform the contents of the `rootField` from this response into an object of the requested type.
      Map<String,​List<String>> getTransportMeta()
      Get transport-specific metadata that came from the server with this response.
      boolean hasData()
      If this response contains any data, this returns `true`; `false` otherwise.
      boolean hasError()
      If this response contains at least one error, this returns `true`; `false` otherwise.
      boolean hasExtensions()
      If this response contains any extensions, this returns `true`; `false` otherwise.
    • Method Detail

      • getData

        jakarta.json.JsonObject getData()
        The 'data' object contained in the response. Can be JsonValue.NULL if the response contains an empty field, or `null` if the response does not contain this field at all.
      • getErrors

        List<GraphQLError> getErrors()
        List of errors contained in this response.
      • getExtensions

        jakarta.json.JsonObject getExtensions()
        List of user-made extensions contained in this response.
      • getList

        <T> List<T> getList​(Class<T> dataType,
                            String rootField)
        Transform the contents of the `rootField` from this response into a list of objects of the requested type. If the response contains this field but it is a single object rather than a list, this method throws an exception. If the response does not contain this field at all, this method throws an exception. If the response contains this field but with a null value, this method returns null.
      • getObject

        <T> T getObject​(Class<T> dataType,
                        String rootField)
        Transform the contents of the `rootField` from this response into an object of the requested type. If the response does not contain this field at all, this method throws an exception. If the response contains this field but it is null, this method returns null.
      • hasData

        boolean hasData()
        If this response contains any data, this returns `true`; `false` otherwise.
      • hasError

        boolean hasError()
        If this response contains at least one error, this returns `true`; `false` otherwise.
      • hasExtensions

        boolean hasExtensions()
        If this response contains any extensions, this returns `true`; `false` otherwise.
      • getTransportMeta

        Map<String,​List<String>> getTransportMeta()
        Get transport-specific metadata that came from the server with this response.