I have an enum file located on src/java in a Grails project.
This enum has it values defined on the code, can i change this values dynamically?
public enum Status
{
value_one, value_two, value_three;
public String getOtherString()
{
switch (this)
{
case value_one:
return "value one";
case value_two:
return "value two";
case value_three:
return "value three";
default:
return "problem";
}
}
@Override
public String toString()
{
switch (this)
{
case value_one:
return "VALUE 1";
case value_two:
return "VALUE 2";
case value_three:
return "VALUE 3";
default:
return "problem happens";
}
}
}
I found a way using a service.
I convert the enum in a .groovy file and used service methods to return the values.
All works!