/** * Convenience method equivalent to $number.format("integer", $foo). * @param obj the number object to be formatted * @return the specified number formatted as an integer * @since VelocityTools 1.3 */ public String integer(Object obj) { return format("integer", obj); }
/** * Convenience method equivalent to $number.format("number", $foo). * @param obj the number object to be formatted * @return the specified number formatted as a number * @since VelocityTools 1.3 */ public String number(Object obj) { return format("number", obj); }
/** * Convenience method equivalent to $number.format("currency", $foo). * @param obj the number object to be formatted * @return the specified number formatted as a currency * @since VelocityTools 1.3 */ public String currency(Object obj) { return format("currency", obj); }
/** * Convenience method equivalent to $number.format("percent", $foo). * @param obj the number object to be formatted * @return the specified number formatted as a percentage * @since VelocityTools 1.3 */ public String percent(Object obj) { return format("percent", obj); }
/** * Converts the specified object to a number and formats it according to * the pattern or style returned by {@link #getFormat()}. * * @param obj the number object to be formatted * @return the specified number formatted as a string * @see #format(String format, Object obj, Locale locale) */ public String format(Object obj) { return format(getFormat(), obj); }
/** * Converts the specified object to a number and returns * a formatted string representing that number in the locale * returned by {@link #getLocale()}. * * @param format the formatting instructions * @param obj the number object to be formatted * @return a formatted string for this locale representing the specified * number or <code>null</code> if the parameters are invalid * @see #format(String format, Object obj, Locale locale) */ public String format(String format, Object obj) { return format(format, obj, getLocale()); }