标签:setname span set equal pos ati oid bsp ret
package com.xx; public enum PositionEM{ ONE(1,"领导"),
TWO(2,"员工"); private Long value; private String name; private PositionEM(Long value,String name) { this.value = value; this.name = name; } public Long getValue() { return value; } public void setValue(Long value) { this.value = value; } public String getName() { return name; } public void setName(String name) { this.name = name; }
public static PositionEM getByName(String name){ for(PositionEM position: PositionEM.values()){ if(position.getName().equals(name)){ return position; } } return null; }
public static PositionEM valueOf(byte status){ for(PositionEM position : PositionEM.values()){ if(position.getValue() == status){ return position; } } return null; } }
PositionEM.ONE.getValue();// 1
PositionEM.ONE.getName();// "领导"
标签:setname span set equal pos ati oid bsp ret
原文地址:https://www.cnblogs.com/gczmn/p/9334137.html