init: ASW-37 初始化 device-api
This commit is contained in:
42
src/main/java/net/geedge/common/RCode.java
Normal file
42
src/main/java/net/geedge/common/RCode.java
Normal file
@@ -0,0 +1,42 @@
|
||||
package net.geedge.common;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
|
||||
public enum RCode {
|
||||
|
||||
|
||||
BAD_REQUEST(400, "Bad Request "),
|
||||
|
||||
NOT_EXISTS(404, "No such file or directory"),
|
||||
NOT_PERMISSION(401 , "Permission denied"),
|
||||
|
||||
ERROR(999, "error"), // 通用错误/未知错误
|
||||
|
||||
SUCCESS(200, "success"); // 成功
|
||||
|
||||
RCode(Integer code, String msg) {
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
}
|
||||
|
||||
private Integer code;
|
||||
private String msg;
|
||||
private Object[] param;
|
||||
|
||||
public RCode setParam(Object... param) {
|
||||
this.param = param;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Object[] getParam() {
|
||||
return param;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getMsg() {
|
||||
return MessageFormat.format(msg, param);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user