自定义枚举类型
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public
enum EnumPartyRole{
SYSTEM(
"SYSTEM",
"XX平台"),
SYSTEM_ADMIN(
"SYSTEM_ADMIN",
"XX平台-超级管理员"),
SYSTEM_OPERATION(
"SYSTEM_OPERATION",
"XX平台-运营");
private
final String code;
private
final
String description;
private
static
final Map<String,EnumPartyRole> lookup =
new HashMap<String,EnumPartyRole>();
static {
for (EnumPartyRole s : EnumSet.
allOf(EnumPartyRole.
class)) { lookup.
put(s.
getCode(), s); } }
public
static EnumPartyRole
get(String code) {
if(code!=
null){code = code.
trim();}
return lookup.
get(code); }
EnumPartyRole(String code,String description) {
this
.
code = code;
this.
description = description; }
public String
getCode() {
return code; }
public String
getDescription() {
return description; } }