Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
clarkdave committed Nov 24, 2011
1 parent 13fcd5c commit 5b284b8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Any work you need to do with collections in particular will benefit from Groovy'
Take a look at the samples/blog app, which is a Groovyified version of the Play 'yabe' app.

### Accessors/mutators ###
Play has you set your model fields as public and then autogenerates get and set methods for it. In Groovy, you should not set a visibility modifier for your fields. The Groovy compiler will default these fields to private but create a get and set method for it, as Play does.
Play has you set your model fields as public and then autogenerates get and set methods for them. In Groovy, you should not set a visibility modifier for your fields. The Groovy compiler will default these fields to private but create a get and set method for it, as Play does.

So while in standard Play you'd do this:

Expand All @@ -33,6 +33,7 @@ So while in standard Play you'd do this:
...
Post p = new Post()
p.title = 'Hello'
System.out.println(p.title)

In Groovy, do this:

Expand All @@ -41,7 +42,8 @@ In Groovy, do this:
}
...
Post p = new Post()
p.title
p.title = 'Hello'
println(p.title)

In both cases, you can override the get/set methods with your own.

Expand Down

0 comments on commit 5b284b8

Please sign in to comment.