Search code examples
grailsenumsgsp

How to get static enum from class


i have an java-constraint-interface declaring some enums.

public interface MyClass{static enum BOOP{a,b,c,d,e,f}};

how can i get dynamicly the name of the 6th enum-const from the "BOOP"-enum?

${org.java.some.MyClass."$enumName"[5]}

doenst work.


Solution

  • I got it by myself

    <%=org.java.some.MyClass.class.getDeclaredClasses().find{it.simpleName=enumName}.values()[5]%>