I have a class where there are a few static final String
variables that have few values that repesent color values. The class is basically used to get the color values. Is it better to convert this to enum?
public class Color{
public static final String GRAY50 = "#808080";
public static final String BLACK = "#000000";
private final String backgroudColor;
public static Color createBasicColor(){
return new Color(GRAY50);
}
public static Color createSubColor(){
return new Color(BLACK);
}
private Color(String defaultColor){
this.backgroundColor = defaultColor;
}
public String getColor(String color){
if(color.equals(GRAY50){
return backgroundColor;
}
return color;
}
}