How to get value of a domain constraint in Grails?

constraints, grails, grails-constraints

Solution

You should be able to do:

def maxBarSize = Foo.constraints.bar.getAppliedConstraint( 'maxSize' ).maxSize

Problem

I have a text field whose length I would like to limit at the maxSize constraint of one of my domain classes. So if I have a class foo: ``` class Foo { String bar static constraints = { bar(maxSize: 100) } } ``` I would like to get that value of 100 for the property bar. Is this possible?

Original source