Login required
Download

Custom domain constraints plugin

(5)
Author(s) Geoff Lane
Current Release 0.8.0   (1 day ago)
Grails Version 2.0 > *
License(s) Apache License 2.0
Organization One-Line Fix, LLC
Tags validation 
Dependency
compile ":constraints:0.8.0"
This plugin allows you to create custom domain validations that are applied the same way as built-in domain constraints.
Last updated by admin 2 years ago
grails install-plugin constraints
Last updated by geofflane 2 years ago
This Grails plugin allows you to create custom domain Constraints for validating Domain objects.

Without this plugin, if you have a custom validation that you want to perform on a Domain object, you have to use a generic validator constraint and define it inline. With this plugin, you can create reusable, shareable constraints that you can use on multiple Domain objects. You can then package Constraints in plugins of their own and reuse them across projects as well.

  • Create a groovy file in /grails-app/utils/ called *Constraint.groovy
  • Implement a validate closure
  • Add appropriate messages to /grails-app/i18n/messages.properties
  • Apply the validation to a Domain class, a Command object or any class marked with @Validateable
Please see the Github repository at http://github.com/geofflane/grails-constraints for full source code and documentation.
Last updated by admin 2 years ago
Last updated by admin 2 years ago