每个项目设计常量类五花八门,所以再次强调最优得设计方式。
public interface Const{
//单个
String APP_NAME="";
//一组
enum DAY {
SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY
}
//一组带状态
enum COLOR {
RED(0, "彩虹-红色"),
ORANGE(1, "彩虹-橙色"),
YELLEOW(2, "彩虹-黄色"),
GREEN(3, "彩虹-绿色"),
BLUE(4, "彩虹-蓝色");
COLOR (int flag, String name) {
this.flag = flag;
this.name = name;
}
private int flag;
private String name;
}
}