NumericDDMFormFieldValueLocalizer implements DDMFormFieldValueEditingAware, DDMFormFieldValueLocalizer { @Override public String localize(String value, Locale locale) { try { DecimalFormat decimalFormat = NumericDDMFormFieldUtil.getNumberFormat(locale); Number number = GetterUtil.getNumber(decimalFormat.parse(value)); String formattedNumber = decimalFormat.format(number); if (!value.equals(formattedNumber)) { DecimalFormat defaultDecimalFormat = NumericDDMFormFieldUtil.getNumberFormat(LocaleUtil.US); number = defaultDecimalFormat.parse(value); formattedNumber = decimalFormat.format(number); String lastChar = String.valueOf( value.charAt(value.length() - 1)); if (isEditingFieldValue() && (lastChar.equals(StringPool.COMMA) || lastChar.equals(StringPool.PERIOD))) { formattedNumber = formattedNumber.concat(lastChar); } } return formattedNumber; } catch (ParseException parseException) { if (_log.isDebugEnabled()) { _log.debug( "Unable to parse number for locale " + locale, parseException); } } return value; }  @Override boolean isEditingFieldValue(); @Override String localize(String value, Locale locale); @Override void setEditingFieldValue(boolean editingFieldValue);  }
@Test public void testLocalize() { String localizedValue = _numericDDMFormFieldValueLocalizer.localize( "1000.95", LocaleUtil.US); Assert.assertEquals("1000.95", localizedValue); }