user734861 user734861 - 2 months ago 10
Groovy Question

Understanding groovy symantics?

I am trying to understand semantics of a particular groovy syntax.

def c = Account.createCriteria()

def results = c.list {
like("holderFirstName", "Fred%")
and {
between("balance", 500, 1000)
eq("branch", "London")
}
maxResults(10)
order("holderLastName", "desc")
}


Is the {content} after c.list a closure. So, that can we understand that c.list method takes in a closure as parameter? Thanks!

Answer

Yes, you are right

c.list

Takes a closure as a parameter

Comments