Class ResponseBase<H,​T>

  • Type Parameters:
    H - The deserialized type of the response headers.
    T - The deserialized type of the response value, available from Response.getValue().
    All Implemented Interfaces:
    Response<T>

    public class ResponseBase<H,​T>
    extends Object
    implements Response<T>
    The response of a REST request.
    • Constructor Detail

      • ResponseBase

        public ResponseBase​(HttpRequest request,
                            int statusCode,
                            HttpHeaders headers,
                            T value,
                            H deserializedHeaders)
        Creates a ResponseBase.
        Parameters:
        request - The HTTP request which resulted in this response.
        statusCode - The status code of the HTTP response.
        headers - The headers of the HTTP response.
        deserializedHeaders - The deserialized headers of the HTTP response.
        value - The deserialized value of the HTTP response.
    • Method Detail

      • getStatusCode

        public int getStatusCode()
        Gets the HTTP response status code.
        Specified by:
        getStatusCode in interface Response<H>
        Returns:
        The status code of the HTTP response.
      • getHeaders

        public HttpHeaders getHeaders()
        Gets the headers from the HTTP response.
        Specified by:
        getHeaders in interface Response<H>
        Returns:
        The HTTP response headers.
      • getDeserializedHeaders

        public H getDeserializedHeaders()
        Get the headers from the HTTP response, transformed into the header type, H.
        Returns:
        An instance of header type H, deserialized from the HTTP response headers.
      • getValue

        public T getValue()
        Gets the deserialized value of the HTTP response.
        Specified by:
        getValue in interface Response<H>
        Returns:
        The deserialized value of the HTTP response.