java的枚举enum根据code获取name等public enum PlatformFree{
FREE("free","卖家包邮"),
POST("post","平邮"),
EXPRESS("express","快递"),
EMS("ems","EMS"),
VIRTUAL("virtual","虚拟发货"),
TWENTY_FIVE("25","次⽇必达"),
TWENTY_SIX("26","预约配送");
private String code;
private String value;
private PlatformFree(String code,String value) {
this.value = value;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}enum c++
public String getCode() {
return code;
}
public void setCode(String code) {
}
/**
* 根据code获取去value
* @param code
* @return
*/
public static String getValueByCode(String code){
for(PlatformFree platformFree:PlatformFree.values()){
if(code.Code())){
Value();
}
}
return null;
}
}