So it turns out that I need a getvalue() method in the enum as well as you need to call that method when you get the value of the enum in a class or controller. That solved my problem
bootstrap enum value giving weird result
-
16-01-2022 - |
Question
I have a domain class that I have a controller and UI that is spitting out [object Object] for the value of an enum.
My enum is as follows:
enum customerenum {
value1('value1'),
value2('value2')
}
and I have a domain class customers
class Customer {
customerenum ce
String location
}
So now I want to bootstrap this
So in my bootstrap I have
class BootStrap {
def init = { servletContext ->
new Customer(
ce:'value1',
location:'USA'
).save()
}
}
However in the actual page, the location shows up USA but the customerenum shows up [object Object]
Any thoughts? Thanks!
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow