enum相当于数据库的表
mysql dbName = CountryEnum
table
one(各表列相同)
ID,username,age
1,一,5
ONE(1,"一",v2)
public enum CountryEnum {
ONE(1,"一","a"),TWO(2,"二","b"),THREE(3,"三","c"),FOUR(4,"四","d"),FIVE(5,"五","e"),SIX(6,"SIX","f");
private IntegerretCode;
private StringretMessage;
private StringretMessage2;
public Integer getRetCode(){
return this.retCode;
}
public String getRetMessage(){
return this.retMessage;
}
public String getRetMessage2(){
return this.retMessage2;
}
CountryEnum(Integer retCode,String retMessage,String retMessage2){
this.retCode = retCode;
this.retMessage = retMessage;
this.retMessage2 = retMessage2;
}
public static CountryEnum foreach_CountryEnum(int index){
CountryEnum[] myArray = CountryEnum.values();
for(CountryEnum ele : myArray){
if(index == ele.retCode){
return ele;
}
}
return null;
}
}
网友评论