title: What does curly brackets syntax mean in Groovy?
body: <p>What does this syntax mean in Groovy?</p>
  
  <pre><code>class CreateMessagePage extends Page {
      static at = { assert title == 'Messages : Create'; true }
      static url = 'messages/form'
      static content =  {
          submit { $('input[type=submit]') }
          MyVeryStrangeForm { $('form') }
          errors(required:false) { $('label.error, .alert-error')?.text() }
      }
  }
  </code></pre>
  
  <p>(taken from <a href="http://docs.spring.io/spring-test-htmlunit/docs/current/reference/html5/#using-geb" rel="noreferrer">Spring MVC Test HtmlUnit manual</a>)</p>
  
  <p>The question is about Groovy and I would like know the answer in Groovy terms.</p>
  
  <p>What is <code>content</code>? Is it a static variable? Is its name is random or predefined by base class of <code>Page</code>? </p>
  
  <p>What is <code>=</code> (equal sign) after it? Is it an assignment operator?</p>
  
  <p>What is at the right hand side of <code>=</code>? Is this a closure? Or if this an anonymous class? Or if these are the same?</p>
  
  <p>What is <code>submit</code> inside curly braces? </p>
  
  <p>Is this a variable? Why there is no assignment operator after it then? </p>
  
  <p>Is this a function definition? Can I define functions in arbitrary places in Groovy? If this is a function definition, then what is <code>errors</code> then?</p>
  
  <p>Is <code>submit</code> is a function call, receiving <code>{ $('input[type=submit]') }</code> as a parameter? If yes, then where is this function can be defined? For example, where is <code>MyVeryStrangeForm</code> defined (is nowhere)?</p>
  
  <p>If this was function call, then it won't work since it's undefined...</p>