Reputation: 459
I have this auto generated lines of codes:
EPRole validator: { EPRole r, EPUserEPRole ur ->
if (ur.EPUser == null) return
boolean existing = false
EPUserEPRole.withNewSession {
existing = EPUserEPRole.exists(ur.EPUser.id, r.id)
}
if (existing) {
return 'userRole.exists'
}
}
When I try to compile the code I get 82: unexpected token: validator @ line 82, column 10.
I am new in groovy so any help is appreciated.
Upvotes: 2
Views: 3775
Reputation: 37008
You should add your properties with the proper type and name to the class. First letter uppercase is for classes (or types in general). So there should be in your EPUserEPRole
a property like this:
EPRole epRole
Then add the validator for epRole
. Pay attention to the case.
Above code would confuse the groovy parser into defining a property validator
of type EPRole
followed by a :
, hence the error (or else it would try to call the method EPRole with the map, depending on context).
Upvotes: 2