Class Response

    • Method Detail

      • jsonrpc

        public String jsonrpc()
        Getter for jsonrpc field.

        It is always "2.0".

        Returns:
        The version of the JSON-RPC protocol
      • id

        public Id<?> id()
        Getter for id field.
        Returns:
        The id of this Response
      • result

        public Optional<com.google.gson.JsonElement> result()
        Getter for result field.

        If the Optional is empty the Response is considered to be an error response.

        Returns:
        The result of this Response
      • error

        public Optional<Error> error()
        Getter for error field.

        If the Optional is not empty the Response is considered to be an error response.

        Returns:
        The error of this Response
      • isSuccessful

        public boolean isSuccessful()
        Whether the request that generated this Response was successful.
        Returns:
        true if result field is present else false
      • isUnsuccessful

        public boolean isUnsuccessful()
        Whether this Response contains an error.
        Returns:
        true if error field is present else false
      • hashCode

        public int hashCode()
        This method is implemented using Objects.hash().

        Overrides:
        hashCode in class Object
        Returns:
        The hash code for this Response
      • equals

        public boolean equals​(Object obj)
        This method returns true if the argument is a Response and all properties are equal, otherwise returns false.

        Overrides:
        equals in class Object
        Parameters:
        obj - The object to be checked
        Returns:
        Whether this is the same as the Object argument
      • toString

        public String toString()
        The returned String is equal to the value of: "Response@" + Integer.toHexString(hashCode()) + " " + contentAsJsonString() where contentAsJsonString() returns a JSON-like String of this Response.
        Overrides:
        toString in class Object
        Returns:
        A String representation of this Response