Saturday, 24 August 2013

Groovy domain syntax explanation

Groovy domain syntax explanation

class User {
static constraints = {
password(unique:true, length:5..15, validator:{val, obj ->
if(val?.equalsIgnoreCase(obj.firstName)) {
return false
}
}
}
}
I'm finding this groovy syntax really confusing. I've spent a few days
trying to learn grails/groovy. I know what it does but I don't really
understand it.
Can someone explain how this works?
What is constraints? Is it a closure, with password being called as a
function? How does it get called?
What about the validator what kind of syntax is that?
Like I said I can see what it does, I just don't understand how it does it.

No comments:

Post a Comment