Enum HttpStatusCode
- java.lang.Object
-
- java.lang.Enum<HttpStatusCode>
-
- com.github.dannil.scbjavaclient.communication.http.HttpStatusCode
-
- All Implemented Interfaces:
Serializable
,Comparable<HttpStatusCode>
public enum HttpStatusCode extends Enum<HttpStatusCode>
Enumerable for the most common HTTP status codes returned by the API.
- Since:
- 1.2.0
-
-
Enum Constant Summary
Enum Constants Enum Constant Description FORBIDDEN
NOT_FOUND
OK
TOO_MANY_REQUESTS
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
asText()
Get the HTTP status code as a text string.int
getCode()
Get the HTTP status code.String
getDescription()
Get the description.static HttpStatusCode
valueOf(int code)
Returns aHttpStatusCode
which corresponds to the input status code.static HttpStatusCode
valueOf(String name)
Returns the enum constant of this type with the specified name.static HttpStatusCode[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
OK
public static final HttpStatusCode OK
-
FORBIDDEN
public static final HttpStatusCode FORBIDDEN
-
NOT_FOUND
public static final HttpStatusCode NOT_FOUND
-
TOO_MANY_REQUESTS
public static final HttpStatusCode TOO_MANY_REQUESTS
-
-
Method Detail
-
values
public static HttpStatusCode[] 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 (HttpStatusCode c : HttpStatusCode.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static HttpStatusCode 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 nameNullPointerException
- if the argument is null
-
getCode
public int getCode()
Get the HTTP status code.
- Returns:
- the status code
-
getDescription
public String getDescription()
Get the description.
- Returns:
- the description
-
asText
public String asText()
Get the HTTP status code as a text string.
- Returns:
- the status code as a text string
-
valueOf
public static HttpStatusCode valueOf(int code)
Returns a
HttpStatusCode
which corresponds to the input status code.- Parameters:
code
- the status code- Returns:
- a
HttpStatusCode
-
-