enum

作者: 梁佳凝 | 来源:发表于2020-05-08 17:19 被阅读0次

    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;

    }

    }

    相关文章

      网友评论

          本文标题:enum

          本文链接:https://www.haomeiwen.com/subject/jvfqnhtx.html