Nella mia istruzione if, voglio confrontare una variabile, che è un enum JDK 1.5, ad un enum letterale. Per esempio:Freemarker: un enum in una dichiarazione if
<#if type == ProblemStatisticType.BEST_SOLUTION_CHANGED>
...
</#if>
Ma ottengo questa eccezione:
freemarker.core.InvalidReferenceException: Expression ProblemStatisticType is undefined on line 430, column 87 in index.html.ftl.
at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:125)
at freemarker.core.TemplateObject.invalidTypeException(TemplateObject.java:135)
Come posso fare questo?
Questo funziona, ma non è il refactoring amichevole. Cosa succede se l'enum sovrascrive il metodo toString()? –