Class AbstractNumberFormatter

    • Method Detail

      • setLenient

        public void setLenient​(boolean lenient)
        Specify whether or not parsing is to be lenient. Default is false.

        With lenient parsing, the parser may allow inputs that do not precisely match the format. With strict parsing, inputs must match the format exactly.

      • print

        public String print​(Number number,
                            Locale locale)
        Description copied from interface: Printer
        Print the object of type T for display.
        Specified by:
        print in interface Printer<Number>
        Parameters:
        number - the instance to print
        locale - the current user locale
        Returns:
        the printed text string
      • parse

        public Number parse​(String text,
                            Locale locale)
                     throws ParseException
        Description copied from interface: Parser
        Parse a text String to produce a T.
        Specified by:
        parse in interface Parser<Number>
        Parameters:
        text - the text string
        locale - the current user locale
        Returns:
        an instance of T
        Throws:
        ParseException - when a parse exception occurs in a java.text parsing library
      • getNumberFormat

        protected abstract NumberFormat getNumberFormat​(Locale locale)
        Obtain a concrete NumberFormat for the specified locale.
        Parameters:
        locale - the current locale
        Returns:
        the NumberFormat instance (never null)