How to use Enum in grails (not in domain class)
Posted
by bsreekanth
on Stack Overflow
See other posts from Stack Overflow
or by bsreekanth
Published on 2010-06-16T02:59:57Z
Indexed on
2010/06/16
3:02 UTC
Read the original article
Hit count: 427
Hello,
i want to use Enum to represent some selection values. In /src/groovy folder, under the package com.test, I created the Enum.
package com.test
public enum TabSelectorEnum {
A(1), B(2)
private final int value
public int value() {return value}
}
Now, I am trying to access it from controller like
TabSelectorEnum.B.value()
It throws an exception
Caused by: org.codehaus.groovy.runtime.InvokerInvocationException: java.lang.NoClassDefFoundError: Could not initialize class com.test.TabSelectorEnum
thanks in advance.
© Stack Overflow or respective owner