/** * <p>Returns a <code>NumberFormat</code> for the specified <i>pattern</i> * and/or <code>Locale</code>.</p> * * @param pattern The pattern used to validate the value against or * <code>null</code> to use the default for the <code>Locale</code>. * @param locale The locale to use for the currency format, system default if null. * @return The <code>NumberFormat</code> to created. */ @Override protected Format getFormat(String pattern, Locale locale) { NumberFormat formatter = null; boolean usePattern = (pattern != null && pattern.length() > 0); if (!usePattern) { formatter = (NumberFormat)getFormat(locale); } else if (locale == null) { formatter = new DecimalFormat(pattern); } else { DecimalFormatSymbols symbols = new DecimalFormatSymbols(locale); formatter = new DecimalFormat(pattern, symbols); } if (determineScale(formatter) == 0) { formatter.setParseIntegerOnly(true); } return formatter; }
/** * <p>Returns a <code>NumberFormat</code> for the specified <i>pattern</i> * and/or <code>Locale</code>.</p> * * @param pattern The pattern used to validate the value against or * <code>null</code> to use the default for the <code>Locale</code>. * @param locale The locale to use for the currency format, system default if null. * @return The <code>NumberFormat</code> to created. */ protected Format getFormat(String pattern, Locale locale) { NumberFormat formatter = null; boolean usePattern = (pattern != null && pattern.length() > 0); if (!usePattern) { formatter = (NumberFormat)getFormat(locale); } else if (locale == null) { formatter = new DecimalFormat(pattern); } else { DecimalFormatSymbols symbols = new DecimalFormatSymbols(locale); formatter = new DecimalFormat(pattern, symbols); } if (determineScale(formatter) == 0) { formatter.setParseIntegerOnly(true); } return formatter; }
/** * <p>Returns a <code>NumberFormat</code> for the specified <i>pattern</i> * and/or <code>Locale</code>.</p> * * @param pattern The pattern used to validate the value against or * <code>null</code> to use the default for the <code>Locale</code>. * @param locale The locale to use for the currency format, system default if null. * @return The <code>NumberFormat</code> to created. */ @Override protected Format getFormat(String pattern, Locale locale) { NumberFormat formatter = null; boolean usePattern = (pattern != null && pattern.length() > 0); if (!usePattern) { formatter = (NumberFormat)getFormat(locale); } else if (locale == null) { formatter = new DecimalFormat(pattern); } else { DecimalFormatSymbols symbols = new DecimalFormatSymbols(locale); formatter = new DecimalFormat(pattern, symbols); } if (determineScale(formatter) == 0) { formatter.setParseIntegerOnly(true); } return formatter; }