com.luues.util.upload.ue.UEError Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of commons-util Show documentation
Show all versions of commons-util Show documentation
A Simple Tool Operations Class
package com.luues.util.upload.ue;
import java.util.HashMap;
import java.util.Map;
public enum UEError {
SUCCESS("SUCCESS", "SUCCESS"),
NOFILE("NOFILE", "未包含文件上传域"),
TYPE("TYPE", "不允许的文件格式"),
SIZE("SIZE", "文件大小超出限制"),
ENTYPE("ENTYPE", "请求类型ENTYPE错误"),
REQUEST("REQUEST", "上传请求异常"),
IO("IO", "IO异常"),
DIR("DIR", "目录创建失败"),
UNKNOWN("UNKNOWN", "未知错误");
private String code;
private String value;
UEError(String code, String value) {
this.code = code;
this.value = value;
}
public static Map getAll(){
Map map = new HashMap();
UEError[] ueErrors;
int j = (ueErrors = values()).length;
for (int i = 0; i < j; i++) {
UEError t = ueErrors[i];
map.put(t.getCode(), t.getValue());
}
return map;
}
public static UEError getByValue(String value) {
UEError[] ueErrors;
int j = (ueErrors = values()).length;
for (int i = 0; i < j; i++) {
UEError t = ueErrors[i];
if (t.getValue().equals(value)) {
return t;
}
}
return null;
}
public static UEError getByCode(String code) {
UEError[] ueErrors;
int j = (ueErrors = values()).length;
for (int i = 0; i < j; i++) {
UEError t = ueErrors[i];
if (t.getCode().equals(code)) {
return t;
}
}
return null;
}
protected String getCode() {
return this.code;
}
protected String getValue() {
return this.value;
}
}