@Test(groups = "fast") public void testFloatingPointsNumbers() { Number number = getConverter().parse("123.456", new ArrayList<ValidationError>()); Assert.assertEquals(number.doubleValue(), 123.456); }
protected Number parse(String input, Collection<ValidationError> errors) { input = preprocess(input); ParsePosition pp = new ParsePosition(0); for (NumberFormat format : this.formats) { pp.setIndex(0); Number number = format.parse(input, pp); if (number != null && input.length() == pp.getIndex()) { return number; } } errors.add(new ScopedLocalizableError("converter.number", "invalidNumber")); return null; }
NumberTypeConverterSupport { protected Number parse(String input, Collection<ValidationError> errors) { input = preprocess(input); ParsePosition pp = new ParsePosition(0); for (NumberFormat format : this.formats) { pp.setIndex(0); Number number = format.parse(input, pp); if (number != null && input.length() == pp.getIndex()) { return number; } } errors.add(new ScopedLocalizableError("converter.number", "invalidNumber")); return null; } }
NumberTypeConverterSupport { protected Number parse(String input, Collection<ValidationError> errors) { input = preprocess(input); ParsePosition pp = new ParsePosition(0); for (NumberFormat format : this.formats) { pp.setIndex(0); Number number = format.parse(input, pp); if (number != null && input.length() == pp.getIndex()) { return number; } } errors.add(new ScopedLocalizableError("converter.number", "invalidNumber")); return null; }  }
NumberTypeConverterSupport { protected Number parse(String input, Collection<ValidationError> errors) { input = preprocess(input); ParsePosition pp = new ParsePosition(0); for (NumberFormat format : this.formats) { pp.setIndex(0); Number number = format.parse(input, pp); if (number != null && input.length() == pp.getIndex()) { return number; } } errors.add(new ScopedLocalizableError("converter.number", "invalidNumber")); return null; }  void setLocale(Locale locale); Locale getLocale(); }
NumberTypeConverterSupport { protected Number parse(String input, Collection<ValidationError> errors) { input = preprocess(input); ParsePosition pp = new ParsePosition(0); for (NumberFormat format : this.formats) { pp.setIndex(0); Number number = format.parse(input, pp); if (number != null && input.length() == pp.getIndex()) { return number; } } errors.add(new ScopedLocalizableError("converter.number", "invalidNumber")); return null; }  void setLocale(Locale locale); Locale getLocale();  }