net.sf.mmm.util.nls.base
Class MappedNlsFormatterManager

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.AbstractNlsFormatterManager
              extended by net.sf.mmm.util.nls.base.MappedNlsFormatterManager
All Implemented Interfaces:
NlsArgumentParser, NlsFormatterManager
Direct Known Subclasses:
NlsFormatterManagerImpl

public abstract class MappedNlsFormatterManager
extends AbstractNlsFormatterManager

This is the implementation of the NlsFormatterManager interface.

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

Field Summary
private  NlsFormatterMap formatterMap
           
 
Fields inherited from class net.sf.mmm.util.nls.base.AbstractNlsFormatterManager
NO_COMMA_OR_END_EXPRESSION, NO_EXPRESSION
 
Fields inherited from interface net.sf.mmm.util.nls.api.NlsFormatterManager
STYLE_CURRENCY, STYLE_FULL, STYLE_INTEGER, STYLE_ISO_8601, STYLE_LONG, STYLE_MEDIUM, STYLE_PERCENT, STYLE_SHORT, TYPE_CHOICE, TYPE_DATE, TYPE_DATETIME, TYPE_NUMBER, TYPE_TIME, TYPE_TYPE
 
Fields inherited from interface net.sf.mmm.util.nls.api.NlsArgumentParser
END_EXPRESSION, FORMAT_SEPARATOR, START_EXPRESSION
 
Constructor Summary
MappedNlsFormatterManager()
          The constructor.
MappedNlsFormatterManager(NlsFormatterMap formatterMap)
          The constructor.
 
Method Summary
 NlsFormatter<?> getFormatter(String formatType, String formatStyle)
          This method gets the NlsFormatter for the given formatType and formatStyle.
protected  NlsFormatterMap getFormatterMap()
           
protected  NlsFormatter<Object> getSubFormatter(String formatType, String subformat)
          This method creates the NlsFormatter for the given formatType and the custom subformat.
 void setFormatterMap(NlsFormatterMap formatterMap)
           
 
Methods inherited from class net.sf.mmm.util.nls.base.AbstractNlsFormatterManager
doInitialize, getFormatter, getFormatter, getJustificationBuilder, getSubFormatter, parse, setJustificationBuilder
 
Methods inherited from class net.sf.mmm.util.component.base.AbstractLoggableComponent
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, toString, wait, wait, wait
 

Field Detail

formatterMap

private NlsFormatterMap formatterMap
See Also:
getFormatter(String, String)
Constructor Detail

MappedNlsFormatterManager

public MappedNlsFormatterManager()
The constructor.


MappedNlsFormatterManager

public MappedNlsFormatterManager(NlsFormatterMap formatterMap)
The constructor.

Parameters:
formatterMap - is the map with the registered formatters.
Method Detail

getSubFormatter

protected NlsFormatter<Object> getSubFormatter(String formatType,
                                               String subformat)
This method creates the NlsFormatter for the given formatType and the custom subformat. It is called if no formatter is registered for the given arguments.

Parameters:
formatType - is the type to be formatted.
subformat - is the custom formatStyle for which no static formatter is registered.
Returns:
the according custom formatter or null if no such formatter is could be created.

getFormatter

public NlsFormatter<?> getFormatter(String formatType,
                                    String formatStyle)
This method gets the NlsFormatter for the given formatType and formatStyle.
To be compliant with MessageFormat the following types and styles need to be supported by the implementation:

formatType:
formatStyle: ATTENTION:
The support for ChoiceFormats is NOT provided in a compatible way as by hacking internal arrays of MessageFormat. Instead this implementation provides a clean configuration via formatStyle when formatType is choice (see NlsFormatterChoice).

Parameters:
formatType - is the type to be formatted.
formatStyle - is the style defining details of formatting.
Returns:
the according NlsFormatter instance.
See Also:
MessageFormat

getFormatterMap

protected NlsFormatterMap getFormatterMap()
Returns:
the formatterMap

setFormatterMap

@Inject
public void setFormatterMap(NlsFormatterMap formatterMap)
Parameters:
formatterMap - is the formatterMap to set


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