Example usage for org.springframework.validation BindingResult getFieldValue

List of usage examples for org.springframework.validation BindingResult getFieldValue

Introduction

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

Prototype

@Nullable
Object getFieldValue(String field);

Source Link

Document

Return the current value of the given field, either the current bean property value or a rejected update from the last binding.

Usage

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 w  w.  j a  va  2  s  .c  o  m*/

    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);
}