net.sf.mmm.util.nls.base
Class SimpleNlsFormatter<O>

java.lang.Object
  extended by net.sf.mmm.util.component.base.AbstractComponent
      extended by net.sf.mmm.util.component.base.AbstractLoggableComponent
          extended by net.sf.mmm.util.nls.base.AbstractNlsFormatter<O>
              extended by net.sf.mmm.util.nls.base.AbstractNlsFormatterPlugin<O>
                  extended by net.sf.mmm.util.nls.base.SimpleNlsFormatter<O>
Type Parameters:
O - is the generic type of the object to format(Object, Locale, Map, NlsTemplateResolver).
All Implemented Interfaces:
NlsFormatter<O>, NlsFormatterPlugin<O>
Direct Known Subclasses:
AbstractSimpleNlsFormatterDate, NlsFormatterCurrency, NlsFormatterDatePattern, NlsFormatterInteger, NlsFormatterNumber, NlsFormatterNumberPattern, NlsFormatterPercent

public abstract class SimpleNlsFormatter<O>
extends AbstractNlsFormatterPlugin<O>

This is an abstract base implementation of NlsFormatter that adapts a Format.

Since:
1.0.0
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)

Constructor Summary
SimpleNlsFormatter()
          The constructor.
 
Method Summary
protected abstract  Format createFormat(Locale locale)
          This method creates the underlying Format to delegate to.
 String format(O object, Locale locale, Map<String,Object> arguments, NlsTemplateResolver resolver)
          This method formats the given object according to the given locale.
 void format(O object, Locale locale, Map<String,Object> arguments, NlsTemplateResolver resolver, Appendable buffer)
          This method formats the given object according to the given locale.
 
Methods inherited from class net.sf.mmm.util.nls.base.AbstractNlsFormatterPlugin
toString
 
Methods inherited from class net.sf.mmm.util.component.base.AbstractLoggableComponent
doInitialize, getLogger, setLogger
 
Methods inherited from class net.sf.mmm.util.component.base.AbstractComponent
doInitialized, getInitializationState, initialize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.sf.mmm.util.nls.api.NlsFormatterPlugin
getStyle, getType
 

Constructor Detail

SimpleNlsFormatter

public SimpleNlsFormatter()
The constructor.

Method Detail

createFormat

protected abstract Format createFormat(Locale locale)
This method creates the underlying Format to delegate to.

Parameters:
locale - is the locale of the Format to create.
Returns:
the according format.

format

public String format(O object,
                     Locale locale,
                     Map<String,Object> arguments,
                     NlsTemplateResolver resolver)
This method formats the given object according to the given locale.

Specified by:
format in interface NlsFormatter<O>
Overrides:
format in class AbstractNlsFormatter<O>
Parameters:
object - is the object to format.
locale - is the locale used for localized formatting.
arguments - is the Map of arguments.
resolver - is the NlsTemplateResolver.
Returns:
the formatted and localized string for the given object.

format

public void format(O object,
                   Locale locale,
                   Map<String,Object> arguments,
                   NlsTemplateResolver resolver,
                   Appendable buffer)
This method formats the given object according to the given locale.

Parameters:
object - is the object to format.
locale - is the locale used for localized formatting.
arguments - is the Map of arguments.
resolver - is the NlsTemplateResolver.
buffer - is where to append the formatted object.


Copyright © 2001-2010 mmm-Team. All Rights Reserved.