I have the following class:
Types.java:
public class Types {
public static class PC {
public static enum Motherboard {
OPTION1("option 1"),
OPTION2("option 2"),
OPTION3("option 3");
private final String displayValue;
private Motherboard(String displayValue) { this.displayValue = displayValue; }
public String getDisplayValue() { return this.displayValue; }
}
};
};
In my Thymeleaf template I have:
<select name="select-motherboard">
<option th:each="size : ${T(jre.maintainme.utils.strings.Types.PC.Motherboard).values()}" th:value="${size}" th:text="${size.displayValue}"></option>
</select>
However, this doesn't seem to work. If however, I put the Motherboard enum into the Types Class, it does... Is there a way I'm missing to be able to nest enums in classes and use them in Thymeleaf?
System.out.println(OPTION1.getClass())
?class jre.maintainme.utils.strings.Types$PC$Motherboard
EDIT: Figured it out. I was using # originally to distinguish the classes, and also . but the correct was as that just pointed out is to use $ between the classes.