Example usage for org.springframework.validation DataBinder DataBinder

List of usage examples for org.springframework.validation DataBinder DataBinder

Introduction

In this page you can find the example usage for org.springframework.validation DataBinder DataBinder.

Prototype

public DataBinder(@Nullable Object target, String objectName) 

Source Link

Document

Create a new DataBinder instance.

Usage

From source file:de.interseroh.report.controller.ParameterFormBinder.java

public void bind(final ParameterForm parameterForm, final MultiValueMap<String, String> requestParameters,
        BindingResult bindingResult) {//  w  w  w  .j a v a2  s .  c  o  m

    final MutablePropertyValues mpvs = createPropertyValues(parameterForm, requestParameters);

    DataBinder dataBinder = new DataBinder(parameterForm, bindingResult.getObjectName());
    dataBinder.bind(mpvs);
    bindingResult.addAllErrors(dataBinder.getBindingResult());
}

From source file:cherry.foundation.type.format.CustomNumberFormatTest.java

private String parseAndPrint(String name, String value) throws BindException {
    Map<String, String> paramMap = new HashMap<>();
    paramMap.put(name, value);//from   w ww.  j  av a2 s .c  om

    Form form = new Form();
    DataBinder binder = new DataBinder(form, "target");
    binder.setConversionService(conversionService);
    binder.bind(new MutablePropertyValues(paramMap));

    BindingResult binding = BindingResultUtils.getBindingResult(binder.close(), "target");
    return (String) binding.getFieldValue(name);
}

From source file:de.siegmar.securetransfer.controller.SendController.java

private DataBinder initBinder() {
    final DataBinder binder = new DataBinder(new EncryptMessageCommand(), "command");
    binder.registerCustomEditor(String.class, new StringTrimmerEditor(true));
    binder.setValidator(validator);//from ww w . j av a  2  s  .com
    return binder;
}

From source file:org.easyrec.plugin.configuration.ConfigurationHelper.java

protected void init() {
    this.configurationWrapper = new BeanWrapperImpl(this.configuration);
    this.parameterFields = getParameterFields(this.configuration);
    this.dataBinder = new DataBinder(this.configuration, "Configuration");
    allowFieldsForDataBinding();//  w w w  .ja  va  2  s .c  o m
    registerPropertyEditors();
    checkForValidator();
}