org.bklab.flow.convertor.StringToDoubleConverter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fluent-vaadin-flow Show documentation
Show all versions of fluent-vaadin-flow Show documentation
Broderick Labs for fluent vaadin flow. Inherits common Vaadin components.
package org.bklab.flow.convertor;
import com.vaadin.flow.data.binder.Result;
import com.vaadin.flow.data.binder.ValueContext;
import com.vaadin.flow.data.converter.Converter;
public class StringToDoubleConverter implements Converter {
@Override
public Result convertToModel(String string, ValueContext valueContext) {
try {
return Result.ok(Double.parseDouble(string));
} catch (Exception e) {
return Result.error("请输入数字");
}
}
@Override
public String convertToPresentation(Double aDouble, ValueContext valueContext) {
return String.valueOf(aDouble);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy