saywow saywow - 4 months ago 30
Groovy Question

Curly brace vs Square bracket

I can't figure out what's the difference between Curly brace and Square bracket in Groovy/Grails
Example :


and :

subject blank: false
content blank: false, maxSize: 2000

can any one help me please?

Thank you


As pointed out in the comments the first is a Map and the second is a closure.

They aren't the same or similar in any way. You seem to be confused because you assume the closure is some type of name value pair. Which, in this case, it would appear to be because of the constraints DSL.

To further understand how this closure is processed you would need to dig deeper into the constraints DSL and see how it uses such things as missing methods and missing properties. It's not a simple subject to explain briefly.