枚举定义
package com.scbd.bdpl.define.enumerate.code;import com.java.comn.assist.EnumDefine;import com.scbd.bdpl.support.annotation.AnnotationCodeType;/**
* @author lp
*/publicenum STRimplementsEnumDefine<STR>{str("字段含义"),;private String description;private STR(String description){this.description= description;}@Overridepublic StringgetDescription(){return description;}}
字符串转枚举
String str="str";//定义枚举code
STR.valueof(str)//STR对应枚举对象
获取枚举对应字段中文
STR.str.getDescription()// =字段含义
枚举转字符串
STR.str.toString()// =str
枚举占用计算机内存,建议少使用