Class NumberTool

  • All Implemented Interfaces:
    Serializable

    public class NumberTool
    extends org.apache.velocity.tools.generic.NumberTool
    Extension of the standard NumberTool that allows the locale specification as string.
    Since:
    7.3
    Author:
    Marco Meschieri - LogicalDOC
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from class org.apache.velocity.tools.generic.FormatConfig

        DEFAULT_FORMAT, FORMAT_KEY
      • Fields inherited from class org.apache.velocity.tools.generic.LocaleConfig

        DEFAULT_LOCALE
      • Fields inherited from class org.apache.velocity.tools.generic.SafeConfig

        LOCK_CONFIG_KEY, LOGGER_NAME_KEY, SAFE_MODE_KEY, USE_CLASS_LOGGER_KEY
    • Constructor Summary

      Constructors 
      Constructor Description
      NumberTool()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      String format​(String format, Object obj, String locale)
      Formats a number using the specified format
      • Methods inherited from class org.apache.velocity.tools.generic.NumberTool

        currency, format, format, format, getNumberFormat, integer, number, percent, toNumber, toNumber, toNumber
      • Methods inherited from class org.apache.velocity.tools.generic.FormatConfig

        getFormat
      • Methods inherited from class org.apache.velocity.tools.generic.LocaleConfig

        getLocale, toLocale
      • Methods inherited from class org.apache.velocity.tools.generic.SafeConfig

        configure, isConfigLocked, isSafeMode
    • Constructor Detail

      • NumberTool

        public NumberTool()
    • Method Detail

      • format

        public String format​(String format,
                             Object obj,
                             String locale)
        Formats a number using the specified format
        Parameters:
        format - the format to use
        obj - the number to format
        locale - a locale specification
        Returns:
        the formatted number