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.
This should work :
public interface MyClass{static enum BOOP{a,b,c,d,e,f}};
${org.java.some.MyClass.BOOP.values()[5]} // prints f
Additionally, you can't get the element with index 6 due to the array is 0-based and you do not have 7 elements in your enum.
I got it by myself
<%=org.java.some.MyClass.class.getDeclaredClasses().find{it.simpleName=enumName}.values()[5]%>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With