38 lines
916 B
Java
38 lines
916 B
Java
package eu.eudat.types;
|
|
|
|
import eu.eudat.entities.Project;
|
|
|
|
/**
|
|
* Created by ikalyvas on 1/23/2018.
|
|
*/
|
|
public enum ApiMessageCode {
|
|
NO_MESSAGE(0),SUCCESS_MESSAGE(200), WARN_MESSAGE(300), ERROR_MESSAGE(400), DEFAULT_ERROR_MESSAGE(444);
|
|
|
|
private Integer value;
|
|
|
|
private ApiMessageCode(Integer value) {
|
|
this.value = value;
|
|
}
|
|
|
|
public Integer getValue() {
|
|
return value;
|
|
}
|
|
|
|
public static ApiMessageCode fromInteger(Integer value) {
|
|
switch (value) {
|
|
case 0:
|
|
return NO_MESSAGE;
|
|
case 200:
|
|
return SUCCESS_MESSAGE;
|
|
case 300:
|
|
return WARN_MESSAGE;
|
|
case 400:
|
|
return ERROR_MESSAGE;
|
|
case 444:
|
|
return DEFAULT_ERROR_MESSAGE;
|
|
default:
|
|
throw new RuntimeException("Unsupported Api Message Code");
|
|
}
|
|
}
|
|
}
|