package com.sitech.cmap.common.enums;
/**
* <p>Description:通知类型枚举类型</p>
* <p>Copyright:Copyright (c) 2017</p>
* <p>Company:SI-TECH </p>
* @author zhouxy
* @version 1.0
* @createtime 2017年5月18日 下午13:30:01
*/
public enum NotifyType {
SMS("SMS", "sms"), EMAIL("邮件", "email"), MESSAGE("短信", "message");
//中文名称
private String name;
//编码
private String code;
private NotifyType(String name, String code) {
this.name = name;
this.code = code;
}
public String getName() {
return name;
}
public static NotifyType getEnum(String code) {
for (NotifyType emu : NotifyType.values()) {
if (emu.code.equals(code)) {
return emu;
}
}
return null;
}
public void setName(String name) {
this.name = name;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public static void main(String[] args) {
//用法
NotifyType.SMS.getClass();
}
}
枚举类的写法与用法
最新推荐文章于 2023-09-14 10:13:05 发布