如果我有这个枚举
public static enum Motorcycle {
YAMAHA("Y", "commons.blue"), BMW("B", "commons.red"), HONDA("H", "commons.yellow"), KAWASAKI("K", "commons.green");
private String abbreviation;
private String color;
SampleStatus(String abbreviation, String color) {
this.abbreviation = abbreviation;
this.color = color;
}
public String getAbbreviation() {
return abbreviation;
}
public String getColor() {
return color;
}
}
如果我有缩写,如何获得颜色?
例如:
字符串品牌=“Y”;
我怎样才能得到相应的颜色(“commons.blue”)