Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

DoubleValidator.java 921B

12345678910111213141516171819202122232425262728293031323334353637
  1. package com.vaadin.data.validator;
  2. /**
  3. * String validator for a double precision floating point number. See
  4. * {@link com.vaadin.data.validator.AbstractStringValidator} for more
  5. * information.
  6. *
  7. * @author IT Mill Ltd.
  8. * @version
  9. * @VERSION@
  10. * @since 5.4
  11. */
  12. @SuppressWarnings("serial")
  13. public class DoubleValidator extends AbstractStringValidator {
  14. /**
  15. * Creates a validator for checking that a string can be parsed as an
  16. * double.
  17. *
  18. * @param errorMessage
  19. * the message to display in case the value does not validate.
  20. */
  21. public DoubleValidator(String errorMessage) {
  22. super(errorMessage);
  23. }
  24. @Override
  25. protected boolean isValidString(String value) {
  26. try {
  27. Double.parseDouble(value);
  28. return true;
  29. } catch (Exception e) {
  30. return false;
  31. }
  32. }
  33. }