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

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
All Implemented Interfaces:
NlsArgumentParser, NlsFormatterManager
Direct Known Subclasses:
MappedNlsFormatterManager

public abstract class AbstractNlsFormatterManager
extends AbstractLoggableComponent
implements NlsFormatterManager, NlsArgumentParser

This is the abstract base implementation of the NlsFormatterManager interface.
You should extend this class rather than directly implementing the NlsFormatterManager interface to gain compatibility with further releases.

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

Field Summary
private  JustificationBuilder justificationBuilder
           
protected static CharFilter NO_COMMA_OR_END_EXPRESSION
          A char filter that accepts everything except ',' and '}'.
protected static CharFilter NO_EXPRESSION
          A char filter that accepts everything except ',' and '}'.
 
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
AbstractNlsFormatterManager()
          The constructor.
 
Method Summary
protected  void doInitialize()
          This method performs the actual initialization.
 NlsFormatter<Object> getFormatter()
          This method gets the default NlsFormatter.
 NlsFormatter<?> getFormatter(String formatType)
          This method gets the NlsFormatter for the given formatType.
protected  JustificationBuilder getJustificationBuilder()
          This method gets the JustificationBuilder used to build Justifications.
protected  NlsFormatter<?> getSubFormatter(String formatType, CharSequenceScanner scanner)
          This method is like NlsFormatterManager.getFormatter(String, String) but reads the style from the given scanner.
 NlsArgument parse(CharSequenceScanner scanner)
          This method parses the internationalized message given as CharSequenceScanner pointing the beginning of an argument (immediately after NlsArgumentParser.START_EXPRESSION).
 void setJustificationBuilder(JustificationBuilder justificationBuilder)
           
 
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
 
Methods inherited from interface net.sf.mmm.util.nls.api.NlsFormatterManager
getFormatter
 

Field Detail

NO_COMMA_OR_END_EXPRESSION

protected static final CharFilter NO_COMMA_OR_END_EXPRESSION
A char filter that accepts everything except ',' and '}'.


NO_EXPRESSION

protected static final CharFilter NO_EXPRESSION
A char filter that accepts everything except ',' and '}'.


justificationBuilder

private JustificationBuilder justificationBuilder
See Also:
getJustificationBuilder()
Constructor Detail

AbstractNlsFormatterManager

public AbstractNlsFormatterManager()
The constructor.

Method Detail

parse

public NlsArgument parse(CharSequenceScanner scanner)
This method parses the internationalized message given as CharSequenceScanner pointing the beginning of an argument (immediately after NlsArgumentParser.START_EXPRESSION).

Specified by:
parse in interface NlsArgumentParser
Parameters:
scanner - is the CharSequenceScanner.
Returns:
the according NlsFormatter instance.
See Also:
NlsFormatterManager.getFormatter(String, String)

getSubFormatter

protected NlsFormatter<?> getSubFormatter(String formatType,
                                          CharSequenceScanner scanner)
This method is like NlsFormatterManager.getFormatter(String, String) but reads the style from the given scanner.

Parameters:
formatType - is the type to be formatted.
scanner - is the current CharSequenceScanner for parsing the style defining details of formatting.
Returns:
the according NlsFormatter.

doInitialize

protected void doInitialize()
This method performs the actual initialization. It is called when AbstractComponent.initialize() is invoked for the first time.
ATTENTION:
When you override this method from a sub-class you need to do a super.AbstractComponent.doInitialize().

Overrides:
doInitialize in class AbstractLoggableComponent

getJustificationBuilder

protected JustificationBuilder getJustificationBuilder()
This method gets the JustificationBuilder used to build Justifications.

Returns:
the JustificationBuilder.

setJustificationBuilder

@Inject
public void setJustificationBuilder(JustificationBuilder justificationBuilder)
Parameters:
justificationBuilder - is the justificationBuilder to set

getFormatter

public NlsFormatter<Object> getFormatter()
This method gets the default NlsFormatter.

Specified by:
getFormatter in interface NlsFormatterManager
Returns:
the default NlsFormatter instance.
See Also:
NlsFormatterManager.getFormatter(String, String)

getFormatter

public NlsFormatter<?> getFormatter(String formatType)
This method gets the NlsFormatter for the given formatType.

Specified by:
getFormatter in interface NlsFormatterManager
Parameters:
formatType - is the type to be formatted.
Returns:
the according NlsFormatter instance.
See Also:
NlsFormatterManager.getFormatter(String, String)


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