Example usage for org.springframework.format Parser parse

List of usage examples for org.springframework.format Parser parse

Introduction

In this page you can find the example usage for org.springframework.format Parser parse.

Prototype

T parse(String text, Locale locale) throws ParseException;

Source Link

Document

Parse a text String to produce a T.

Usage

From source file:org.jdal.ui.bind.ControlBinder.java

/**
 * {@inheritDoc}/* w w  w. j a  v  a 2 s  .  c  o  m*/
 */
@Override
protected void doUpdate() {
    Object value = controlAccessor.getControlValue();

    if (controlAccessor.isTextControl()) {
        Parser<?> parser = getParser();
        if (parser != null)
            try {
                value = parser.parse((String) value, Locale.getDefault());
            } catch (ParseException e) {
                log.error("Can't parse String : " + value.toString());
            }
    }
    setValue(value);

}