Class GroovyScriptValidator<T>

java.lang.Object
io.jmix.flowui.component.validation.AbstractValidator<T>
io.jmix.dynattrflowui.impl.GroovyScriptValidator<T>
Type Parameters:
T - any Object
All Implemented Interfaces:
Validator<T>, Consumer<T>, org.springframework.beans.factory.Aware, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware

@Component("dynat_GroovyScriptValidator") @Scope("prototype") public class GroovyScriptValidator<T> extends AbstractValidator<T>
GroovyScript validator runs a custom Groovy script. If the script returns any object, then ValidationException is thrown. scriptResult.toString() is used as error message.

For error message it uses template string and it is possible to use '${value}' key for formatted output.

In order to provide your own implementation globally, create a subclass and register it in configuration class, for example:

     @Bean("dynattr_GroovyScriptValidator")
     @Scope(BeanDefinition.SCOPE_PROTOTYPE)
     @Primary
     protected GroovyScriptValidator groovyScriptValidator() {
          return new CustomGroovyScriptValidator();
     }