Enum RestRequestHttpResponseCode

    • Method Detail

      • values

        public static RestRequestHttpResponseCode[] values​()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (RestRequestHttpResponseCode c : RestRequestHttpResponseCode.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static RestRequestHttpResponseCode valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • fromCode

        public static Optional<RestRequestHttpResponseCode> fromCode​(int code)
        Gets the rest request http response code by actual numeric response code.
        Parameters:
        code - The actual numeric response code.
        Returns:
        The rest request http response code with the actual numeric response code.
      • fromDiscordExceptionClass

        public static Optional<RestRequestHttpResponseCode> fromDiscordExceptionClass​(Class<? extends DiscordException> discordExceptionClass)
        Gets the rest request http response code by discord exception class. If no entry for the given class is found, the parents are checked until match is found or DiscordException is reached.
        Parameters:
        discordExceptionClass - The discord exception class.
        Returns:
        The rest request http response code with the discord exception class.
      • getCode

        public int getCode​()
        Gets the actual numeric response code.
        Returns:
        The actual numeric response code.
      • getMeaning

        public String getMeaning​()
        Gets the textual meaning.
        Returns:
        The textual meaning.
      • getDiscordException

        public Optional<? extends DiscordException> getDiscordException​(Exception origin,
                                                                        String message,
                                                                        RestRequestInformation request,
                                                                        RestRequestResponseInformation response)
        Gets the discord exception to throw for this kind of result code.
        Parameters:
        origin - The origin of the exception.
        message - The message of the exception.
        request - The information about the request.
        response - The information about the response.
        Returns:
        The discord exception to throw for this kind of result code.
      • getDiscordExceptionClass

        public Optional<? extends Class<? extends DiscordException>> getDiscordExceptionClass​()
        Gets the discord exception class to throw for this kind of result code.
        Returns:
        The discord exception class to throw for this kind of result code.