net.sourceforge.stripes.format
Interface FormatterFactory

All Superinterfaces:
ConfigurableComponent
All Known Implementing Classes:
DefaultFormatterFactory

public interface FormatterFactory
extends ConfigurableComponent

Interface for creating instances of formatter classes that are capable of formatting the types specified into Strings.

Author:
Tim Fennell
See Also:
Formatter

Method Summary
 void add(Class<?> targetType, Class<? extends Formatter<?>> formatterClass)
          Adds a formatter to the set of registered formatters, overriding an existing formatter if one was already registered for the type.
 Formatter<?> getFormatter(Class<?> clazz, Locale locale, String formatType, String formatPattern)
          Returns a configured formatter that meets the criteria specified.
 
Methods inherited from interface net.sourceforge.stripes.config.ConfigurableComponent
init
 

Method Detail

getFormatter

Formatter<?> getFormatter(Class<?> clazz,
                          Locale locale,
                          String formatType,
                          String formatPattern)
Returns a configured formatter that meets the criteria specified. The formatter is ready for use as soon as it is returned from this method.

Parameters:
clazz - the type of object being formatted
locale - the Locale into which the object should be formatted
formatType - the manner in which the object should be formatted (allows nulls)
formatPattern - the named format, or format pattern to be applied (allows nulls)
Returns:
Formatter an instance of a Formatter, or null if no Formatter is available for the type specified

add

void add(Class<?> targetType,
         Class<? extends Formatter<?>> formatterClass)
Adds a formatter to the set of registered formatters, overriding an existing formatter if one was already registered for the type. This is an optional operation. If an implementation does not support adding formatters at runtime, then it must throw UnsupportedOperationException.

Parameters:
targetType - the type for which the formatter will handle formatting
formatterClass - the implementation class that will handle the formatting
Throws:
UnsupportedOperationException - if the implementation does not support adding formatters at runtime


? Copyright 2005-2006, Stripes Development Team.