枚举类在后端中的编写
public enum TaskTriggerTypeEnum {
CHILD((byte) 1, "儿童"),
YOUTH((byte) 2, "青年");
Byte type;
String desc;
TaskTriggerTypeEnum(Byte type, String desc) {
this.type = type;
this.desc = desc;
}
public Byte getType() {
return type;
}
public void setType(Byte type) {
this.type = type;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public static boolean contain(Byte type) {
if (null == type) {
return false;
}
for (TaskTriggerTypeEnum taskTriggerTypeEnum : values()) {
if (type == taskTriggerTypeEnum.getType()) {
return true;
}
}
return false;
}
public static TaskTriggerTypeEnum getEnumByType(Byte triggerType) {
if (triggerType != null) {