This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class ReallyNoisyEventListener implements ApplicationListener { | |
| void onApplicationEvent( ApplicationEvent e ) { | |
| println e | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def company = new Company( "Acme" ) | |
| def person = new Person( firstname : "Bob", lastname : "Bobbyson", age : 80 ) | |
| company.addToPeople( person ) | |
| company.save() | |
| person.findByFirstName( "Bob" ) // finds all "Bob"s | |
| person.findAll( "from Person where Company = :company", [ company: company ] ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def outerVariable = "foo" | |
| def closure = { closureArgument -> | |
| println "$closureArgument $outerVariable" | |
| } | |
| (1..10).each{ i -> | |
| closure.call( i ) //prints "1 foo", "2 foo", etc. | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static constraints = { | |
| name( blank: false ) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package recordstore | |
| class Thing { | |
| static mapping = { | |
| version false | |
| autoTimestamp false | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package recordstore | |
| class Album { | |
| // Mappings | |
| static hasMany = [ | |
| songs : Song, | |
| artists : Artist | |
| ] | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package recordstore | |
| class Album { | |
| // Mappings | |
| static hasMany = [ | |
| songs : Song | |
| ] | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package recordstore | |
| class Album { | |
| String name | |
| static constraints = { | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package angulartodo | |
| import org.springframework.dao.DataIntegrityViolationException | |
| import grails.converters.JSON | |
| class TodoController { | |
| static allowedMethods = [ajaxList: "GET", ajaxSave: "POST", ajaxComplete: "POST"] | |
| /** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Custom marshalling | |
| springContext.getBean( "customObjectMarshallers" ).register() |