Say I have this enum:
public class MyErrors {
public enum Errors {
BAD_FILE_PATH("Please point to a valid file");
private final String message;
Errors(final String message) {
this.message = message;
}
@Override
public String toString() {
return message;
}
}
And this call:
Logging.log(Level.INFO, MyErrors.Errors.BAD_FILE_PATH.toString());
It seems so verbose to me to have to call .toString(). Isn't there a way to just call the enum itself and have it return its string by default?
Ideally I'd like something like MyErrors.BAD_FILE_PATH --> which returns a string so it's not so verbose. Does that make any sense?