My validation looks like:
static constraints =
{
someProperty validator: { val, obj ->
// a lot of code here
}
}
How can I define external function which will pass to this validation (val, obj requierd) ?
Now my code isn’t clear in constraints closures… there’s too much validation code for someProperty.
How can I change it?
By creating a groovy class in the src/groovy directory, like :
Then, on your domain class use it like below :