I was reading grails criteria API , I find the following code in grails API here
def c = Account.createCriteria() def results = c { projections { groupProperty("branch") } like("holderFirstName", "Fred%") and { between("balance", 500, 1000) eq("branch", "London") } maxResults(10) order("holderLastName", "desc") } my question is calling Account.createCriteria() will gives you grails.orm.HibernateCriteriaBuilder object but when say "c { ....}" , I know colsure is getting called but the object we have is HibernateCriteriaBuilder object not the Closure object , then how the closure is getting called .