I have an enum containing reference to a class of enum like so:
enum Animal {
DOG(DayOfWeek.class),
CAT(Month.class);
public Class<? extends Enum> clazz;
Animal(Class<? extends Enum> c) {
this.clazz = c;
}
public String getValuesConcat() {
String allValues = "";
// The following line doesn't compile
for (Object enumValue : EnumSet.allOf(clazz)) {
allValues += " " + enumValue.toString();
}
return allValues;
}
}
I couldn't figure out a way to store Enum class so that I can get the list of values from it later. Any clues?