custom simple constraint grails

后端 未结 1 2065
不思量自难忘°
不思量自难忘° 2021-01-06 18:30

I would like to create a custom simple constraint (like display and editable) which I can use within my Domain class. Is it possible to extend ConstrainedProperty class?

相关标签:
1条回答
  • 2021-01-06 18:50

    To create your own constraint:

    • extend org.codehaus.groovy.grails.validation.AbstractConstraint
    • register the class as a constraint by calling org.codehaus.groovy.grails.validation.ConstrainedProperty.registerNewConstraint

    Take a look at the grails implementation of the size constraint for an example.

    0 讨论(0)
提交回复
热议问题