org.springframework.ui.format
Interface Formatter<T>

Type Parameters:
T - the type of object this formatter can format
All Known Implementing Classes:
AbstractNumberFormatter, CurrencyFormatter, DateFormatter, DecimalFormatter, IntegerFormatter, PercentFormatter

public interface Formatter<T>

Formats objects of type T for display.

Since:
3.0
Author:
Keith Donald

Method Summary
 String format(T object, Locale locale)
          Format the object of type T for display.
 T parse(String formatted, Locale locale)
          Parse an object from its formatted representation.
 

Method Detail

format

String format(T object,
              Locale locale)
Format the object of type T for display.

Parameters:
object - the object to format
locale - the user's locale
Returns:
the formatted display string

parse

T parse(String formatted,
        Locale locale)
        throws ParseException
Parse an object from its formatted representation.

Parameters:
formatted - a formatted representation
locale - the user's locale
Returns:
the parsed object
Throws:
ParseException - when a parse exception occurs
RuntimeException - when thrown by coercion methods that are