package foundation.capacity;
|
|
import foundation.org.Position;
|
import foundation.user.User;
|
import foundation.util.Util;
|
|
public enum TargetType {
|
|
Org, Position, User, None;
|
|
public static TargetType parse(String value) {
|
if (Util.isEmpty(value)) {
|
return None;
|
}
|
|
value = value.toLowerCase();
|
|
if ("org".equals(value)) {
|
return Org;
|
}
|
else if ("position".equals(value)) {
|
return Position;
|
}
|
else if ("user".equals(value)) {
|
return User;
|
}
|
|
return None;
|
}
|
|
public static TargetType parse(Object value) {
|
if (value == null) {
|
return None;
|
}
|
else if ("org".equals(value)) {
|
return Org;
|
}
|
else if (value instanceof Position) {
|
return Position;
|
}
|
else if (value instanceof User) {
|
return User;
|
}
|
|
return None;
|
}
|
|
public String toChinese(Object value) {
|
if (value == null) {
|
return "无";
|
}
|
else if (value == Org) {
|
return "公司";
|
}
|
else if (value == Position) {
|
return "岗位";
|
}
|
else if (value == User) {
|
return "用户";
|
}
|
|
return "无";
|
}
|
|
}
|