类 AbstractNumberFormatter

java.lang.Object
cn.taketoday.format.number.AbstractNumberFormatter
所有已实现的接口:
Formatter<Number>, Parser<Number>, Printer<Number>
直接已知子类:
CurrencyStyleFormatter, NumberStyleFormatter, PercentStyleFormatter

public abstract class AbstractNumberFormatter extends Object implements Formatter<Number>
Abstract formatter for Numbers, providing a getNumberFormat(Locale) template method.
从以下版本开始:
4.0
作者:
Juergen Hoeller, Keith Donald
  • 构造器详细资料

    • AbstractNumberFormatter

      public AbstractNumberFormatter()
  • 方法详细资料

    • 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)
      从接口复制的说明: Printer
      Print the object of type T for display.
      指定者:
      print 在接口中 Printer<Number>
      参数:
      number - the instance to print
      locale - the current user locale
      返回:
      the printed text string
    • parse

      public Number parse(String text, Locale locale) throws ParseException
      从接口复制的说明: Parser
      Parse a text String to produce a T.
      指定者:
      parse 在接口中 Parser<Number>
      参数:
      text - the text string
      locale - the current user locale
      返回:
      an instance of T
      抛出:
      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.
      参数:
      locale - the current locale
      返回:
      the NumberFormat instance (never null)