pinker
pinker

Reputation: 1293

Groovy LinkedHashMap --- strange notation

I found the following Groovy code. Does anyone knows what it does mean the rows column notation? How can I make use of the "mapping"?

class TextAreaView {

  Integer rows
  Integer cols

  static mapping = {
    rows column: "rows_size"
    cols column: "cols_size"
  }
}

Thanks!

Upvotes: 1

Views: 243

Answers (1)

tim_yates
tim_yates

Reputation: 171114

That's a grails domain class mapped onto custom fields in the database.

See http://grails.org/doc/latest/guide/GORM.html#tableAndColumnNames

You don't use it directly.

The format is basically passing a map to a method.

If you add parentheses, it would look like:

rows( [ column:'rows_size' ] )

Upvotes: 3

Related Questions