Spring Framework

org.springframework.format.number
Class PercentFormatter

java.lang.Object
  extended by org.springframework.format.number.AbstractNumberFormatter
      extended by org.springframework.format.number.PercentFormatter
All Implemented Interfaces:
Formatter<java.lang.Number>, Parser<java.lang.Number>, Printer<java.lang.Number>

public class PercentFormatter
extends AbstractNumberFormatter

A Number formatter for percent values.

Delegates to NumberFormat.getPercentInstance(Locale). Configures BigDecimal parsing so there is no loss in precision. The AbstractNumberFormatter.parse(String, Locale) routine always returns a BigDecimal.

Since:
3.0
Author:
Keith Donald, Juergen Hoeller
See Also:
AbstractNumberFormatter.setLenient(boolean)

Constructor Summary
PercentFormatter()
           
 
Method Summary
protected  java.text.NumberFormat getNumberFormat(java.util.Locale locale)
          Obtain a concrete NumberFormat for the specified locale.
 
Methods inherited from class org.springframework.format.number.AbstractNumberFormatter
parse, print, setLenient
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PercentFormatter

public PercentFormatter()
Method Detail

getNumberFormat

protected java.text.NumberFormat getNumberFormat(java.util.Locale locale)
Description copied from class: AbstractNumberFormatter
Obtain a concrete NumberFormat for the specified locale.

Specified by:
getNumberFormat in class AbstractNumberFormatter
Parameters:
locale - the current locale
Returns:
the NumberFormat instance (never null)

Spring Framework