枚举类、内部类

来源:互联网 发布:热门的数据库研究方向 编辑:程序博客网 时间:2024/05/22 05:06
1、Demo01
public enum TestInfoType {/**自定义描述信息*/TYPE_01("1",PriorityEnum.PRIORITY_5.getValue()),/**自定义描述信息*/TYPE_02("2",PriorityEnum.PRIORITY_5.getValue()),/**自定义描述信息*/TYPE_03("3",PriorityEnum.PRIORITY_8.getValue()),/**自定义描述信息 */TYPE_04("4",PriorityEnum.PRIORITY_20.getValue()),/**自定义描述信息*/TYPE_05("5",PriorityEnum.PRIORITY_20.getValue()),/**自定义描述信息*/TYPE_16("16",PriorityEnum.PRIORITY_14.getValue());//状态码private String code;        //优先级private Integer priority;/** * 私有构造器 * @param code */private TestInfoType(String code,Integer priority){this.code=code;this.priority=priority;}/* * get方法 */public String getCode() {return code;}/*set方法public void setCode(String code) {this.code = code;}*/public Integer getPriority() {return priority;}/*set方法public void setPriority(Integer priority) {this.priority = priority;}*/}


2、Demo02
public class TestConstants {    public static final Integer TYPE_INT_CONTENT=8888;    public static final String TYPE_STR_CONTENT="9999";    /**     * 自定义注释     */    public abstract class Test01 {        public static final String Test01_A="0";        public static final int Test01_B=1;     }    /**     * 自定义注释     */    public static class Test02 {        public static final String Test02_A="ADVANCE_BRANCH";        public static final String  Test02_B="MODOU_SHARE_HTML";    }     /**     * 自定义注释     */    public static class Test03{    private Test03(){}        public static final String Test03_A= "6";     }}使用:Test01.Test01_ATest02.Test02_B
0 0
原创粉丝点击