/** * @param primitive * <code>true</code> if the convert to type is a double * @return to Double converter for the default locale */ public static StringToNumberConverter<Double> toDouble(boolean primitive) { return toDouble(NumberFormat.getNumberInstance(), primitive); }
/** * @param primitive * <code>true</code> if the type is a float * @return Float converter for the default locale */ public static NumberToStringConverter fromFloat(boolean primitive) { return fromFloat(NumberFormat.getNumberInstance(), primitive); }
/** * @param primitive * <code>true</code> if the type is a double * @return Double converter for the default locale */ public static NumberToStringConverter fromDouble(boolean primitive) { return fromDouble(NumberFormat.getNumberInstance(), primitive); }
/** * @param primitive * <code>true</code> if the convert to type is a double * @return to Double converter for the default locale */ public static StringToNumberConverter toDouble(boolean primitive) { return toDouble(NumberFormat.getNumberInstance(), primitive); }
/** * @return to BigDecimal converter for the default locale * @since 1.2 */ public static StringToNumberConverter toBigDecimal() { return toBigDecimal(NumberFormat.getNumberInstance()); }
/** * @param primitive * <code>true</code> if the convert to type is a float * @return to Float converter for the default locale */ public static StringToNumberConverter toFloat(boolean primitive) { return toFloat(NumberFormat.getNumberInstance(), primitive); }
/** * @return BigDecimal convert for the default locale * @since 1.2 */ public static NumberToStringConverter fromBigDecimal() { return fromBigDecimal(NumberFormat.getNumberInstance()); }
/** * @param primitive * <code>true</code> if the convert to type is a float * @return to Float converter for the default locale */ public static StringToNumberConverter<Float> toFloat(boolean primitive) { return toFloat(NumberFormat.getNumberInstance(), primitive); }
/** * @return BigDecimal convert for the default locale * @since 1.2 */ public static NumberToStringConverter fromBigDecimal() { return fromBigDecimal(NumberFormat.getNumberInstance()); }
/** * @param primitive * <code>true</code> if the convert to type is a double * @return to Double converter for the default locale */ public static StringToNumberConverter toDouble(boolean primitive) { return toDouble(NumberFormat.getNumberInstance(), primitive); }
/** * @param primitive * <code>true</code> if the type is a double * @return Double converter for the default locale */ public static NumberToStringConverter fromDouble(boolean primitive) { return fromDouble(NumberFormat.getNumberInstance(), primitive); }
/** * @return BigDecimal convert for the default locale * @since 1.2 */ public static NumberToStringConverter fromBigDecimal() { return fromBigDecimal(NumberFormat.getNumberInstance()); }
/** * @param primitive * <code>true</code> if the type is a float * @return Float converter for the default locale */ public static NumberToStringConverter fromFloat(boolean primitive) { return fromFloat(NumberFormat.getNumberInstance(), primitive); }
/** * @return to BigDecimal converter for the default locale * @since 1.2 */ public static StringToNumberConverter<BigDecimal> toBigDecimal() { return toBigDecimal(NumberFormat.getNumberInstance()); }
/** * @param primitive * <code>true</code> if the type is a double * @return Double converter for the default locale */ public static NumberToStringConverter fromDouble(boolean primitive) { return fromDouble(NumberFormat.getNumberInstance(), primitive); }
/** * @param primitive * <code>true</code> if the type is a float * @return Float converter for the default locale */ public static NumberToStringConverter fromFloat(boolean primitive) { return fromFloat(NumberFormat.getNumberInstance(), primitive); }
/** * @param primitive * <code>true</code> if the convert to type is a float * @return to Float converter for the default locale */ public static StringToNumberConverter toFloat(boolean primitive) { return toFloat(NumberFormat.getNumberInstance(), primitive); }
/** * @return to BigDecimal converter for the default locale * @since 1.2 */ public static StringToNumberConverter toBigDecimal() { return toBigDecimal(NumberFormat.getNumberInstance()); }
/** Format a decimal number to the pattern given * @param number The price double to be formatted * @param pattern pattern apply to format number * @param locale The Locale used to format the number * @return A String with the formatted price */ public static String formatDecimalNumber(double number, String pattern, Locale locale) { com.ibm.icu.text.NumberFormat nf = com.ibm.icu.text.NumberFormat.getNumberInstance(locale); String nbParsing = ""; ((com.ibm.icu.text.DecimalFormat)nf).applyPattern( pattern ); ((com.ibm.icu.text.DecimalFormat)nf).toPattern(); nbParsing = nf.format(number); return nbParsing; }
private void setup() { if (locale == null) { if (format != null) { locale = format.getLocale(null); } else { locale = ULocale.getDefault(Category.FORMAT); } // Needed for getLocale(ULocale.VALID_LOCALE) setLocale(locale, locale); } if (format == null) { format = NumberFormat.getNumberInstance(locale); } pluralRules = PluralRules.forLocale(locale); timeUnitToCountToPatterns = new HashMap<TimeUnit, Map<String, Object[]>>(); Set<String> pluralKeywords = pluralRules.getKeywords(); setup("units/duration", timeUnitToCountToPatterns, FULL_NAME, pluralKeywords); setup("unitsShort/duration", timeUnitToCountToPatterns, ABBREVIATED_NAME, pluralKeywords); isReady = true; }