public class MyConstants {
public static final int STATE_ONE = 1;
public static final int STATE_TWO = 2;
public static final int STATE_THREE = 3;
// 自定义一个注解MyState
@IntDef({STATE_ONE, STATE_TWO, STATE_THREE})
public @interface MyState {}
}
使用注解代替enum
最新推荐文章于 2022-08-20 19:53:37 发布