In a Java Enum it is possible to add a non static method that works based on that enums instance.
So given the following enum this code TestEnum.FOO.getName();
would print "foo"
public static enum TestEnum {
FOO("foo"),
BAR("bar");
private final String name;
private TestEnum(String name) {
this.name = name;
}
public String getName() {
return this.name;
}
}
What is the simplest way to do this in scala?