Package net.thauvin.erik.httpstatus
Enum Class StatusCodeClass
- All Implemented Interfaces:
Serializable,Comparable<StatusCodeClass>,Constable
Represents the classification of HTTP status codes based on their first digit.
Each enum constant corresponds to one of the standard HTTP status code classes.
INFORMATIONAL— status codes starting with1SUCCESSFUL— status codes starting with2REDIRECTION— status codes starting with3CLIENT_ERROR— status codes starting with4SERVER_ERROR— status codes starting with5
- Since:
- 2.0.0
- Author:
- Erik C. Thauvin
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionStatus codes starting with4.Status codes starting with1.Status codes starting with3.Status codes starting with5.Status codes starting with2. -
Method Summary
Modifier and TypeMethodDescriptionstatic Optional<StatusCodeClass>fromFirstDigit(int firstDigit) Returns the classification corresponding to the given first digit.intReturns the first digit representing this HTTP status code class.static StatusCodeClassReturns the enum constant of this class with the specified name.static StatusCodeClass[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
INFORMATIONAL
Status codes starting with1. -
SUCCESSFUL
Status codes starting with2. -
REDIRECTION
Status codes starting with3. -
CLIENT_ERROR
Status codes starting with4. -
SERVER_ERROR
Status codes starting with5.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified nameNullPointerException- if the argument is null
-
fromFirstDigit
Returns the classification corresponding to the given first digit. The digit must be between1and5.Returns an empty
Optionalif the digit does not correspond to a known HTTP status code class. -
getFirstDigit
public int getFirstDigit()Returns the first digit representing this HTTP status code class.
-