Grails annotation – Validateable

15 / Sep / 2010 by Aman Aggarwal 0 comments

We can easily validate domain classes and command objects using static constraints. But how about validating DTOs or any groovy class in src/groovy folder.

The answer is YES, they can be validated too. Follow two simple steps:

1. Add annotation ‘@Validateable’ above the class.
2. Declare the package to be validated in Config.groovy as:

grails.validateable.packages = ['com.mycompany.dto']

Click here to read complete documentation.

I wish I knew this earlier. Grails rocks!!

~Aman Aggarwal
aman@intelligrape.com

http://www.IntelliGrape.com/

FOUND THIS USEFUL? SHARE IT

Leave a Reply

Your email address will not be published. Required fields are marked *