12345678910111213141516171819202122232425262728293031323334353637383940 |
- /*
- @ITMillApache2LicenseForJavaFiles@
- */
- package com.vaadin.data.validator;
-
- /**
- * String validator for a double precision floating point number. See
- * {@link com.vaadin.data.validator.AbstractStringValidator} for more
- * information.
- *
- * @author IT Mill Ltd.
- * @version
- * @VERSION@
- * @since 5.4
- */
- @SuppressWarnings("serial")
- public class DoubleValidator extends AbstractStringValidator {
-
- /**
- * Creates a validator for checking that a string can be parsed as an
- * double.
- *
- * @param errorMessage
- * the message to display in case the value does not validate.
- */
- public DoubleValidator(String errorMessage) {
- super(errorMessage);
- }
-
- @Override
- protected boolean isValidString(String value) {
- try {
- Double.parseDouble(value);
- return true;
- } catch (Exception e) {
- return false;
- }
- }
-
- }
|