private Object createRuntimeConstraintEvaluator ( final String name , ConstrainedProperty [ ] constraints ) { if ( constraints == null ) return null ; for ( ConstrainedProperty constraint : constraints ) { if ( constraint . getPropertyName ( ) . equals ( name ) ) { return new Closure ( this ) { private static final long serialVersionUID = - 2404119898659287216L ; @ Override public Object call ( Object ... objects ) { GrailsWebRequest webRequest = ( GrailsWebRequest ) RequestContextHolder . currentRequestAttributes ( ) ; return webRequest . getParams ( ) . get ( name ) ; } } ; } } return null ; }
This method will look for a constraint for the given name and return a closure that when executed will attempt to evaluate its value from the bound request parameters at runtime .