Class NumberTool


  • 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
    • Field Summary

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

        DEFAULT_FORMAT_KEY, DEFAULT_LOCALE_KEY
      • 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, OLD_LOCK_CONFIG_KEY, SAFE_MODE_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
      • 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