-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHttpStatus.java
More file actions
35 lines (28 loc) · 809 Bytes
/
Copy pathHttpStatus.java
File metadata and controls
35 lines (28 loc) · 809 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package enumeration.test.http;
public enum HttpStatus {
OK(200, "OK"), BAD_REQUEST(400, "Bad Request"), NOT_FOUND(404, "Not Found"), INTERNAL_SERVER_ERROR(500, "Internal Server Error");
private final int code;
private final String message;
HttpStatus(int code, String message){
this.code = code;
this.message = message;
}
public int getCode() {
return code;
}
public String getMessage() {
return message;
}
public static HttpStatus findByCode(int findCode){
for(HttpStatus value : values()){
if(value.code == findCode)
return value;
}
return null;
}
public Boolean isSuccess(){
if(code >= 200 && code <300)
return true;
return false;
}
}