net.sf.mmm.util.nls.impl.formatter
Class NlsMessageFormatterImpl
java.lang.Object
net.sf.mmm.util.component.base.AbstractComponent
net.sf.mmm.util.component.base.AbstractLoggableComponent
net.sf.mmm.util.nls.base.AbstractNlsFormatter<Void>
net.sf.mmm.util.nls.base.AbstractNlsMessageFormatter
net.sf.mmm.util.nls.impl.formatter.NlsMessageFormatterImpl
- All Implemented Interfaces:
- NlsFormatter<Void>, NlsMessageFormatter
public class NlsMessageFormatterImpl
- extends AbstractNlsMessageFormatter
This is the implementation of the
NlsMessageFormatter interface.
NOTE:
This is more or less a rewrite of MessageFormat and is
syntax-compatible with the
MessageFormat-pattern
-format. Some special (and somewhat sick) features as modifying internal
Formats or FieldPosition are NOT
supported. Currently also parsing is NOT supported.
Instead this implementation is immutable and thread-safe. Further it works on
any Appendable rather than only on StringBuffer. It also uses
the same Appendable for recursive invocations.
- Since:
- 1.0.0
- Author:
- Joerg Hohwiller (hohwille at users.sourceforge.net)
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
segments
private final NlsMessageFormatterImpl.PatternSegment[] segments
- The parsed segments of the message pattern.
suffix
private final String suffix
- The suffix (last segment) of the pattern.
nlsDependnecies
private final NlsDependencies nlsDependnecies
- The
NlsDependencies to use.
NlsMessageFormatterImpl
public NlsMessageFormatterImpl(String pattern,
NlsDependencies nlsDependencies)
- The constructor.
- Parameters:
pattern - is the pattern of the message to format. It is
syntax-compatible with MessageFormat.nlsDependencies - are the NlsDependencies.
format
public final void format(Void nothing,
Locale locale,
Map<String,Object> arguments,
NlsTemplateResolver resolver,
Appendable buffer)
throws IOException
- This method formats the underlying pattern by filling in the given
arguments and writing the result into the given
buffer.
This method formats the given object according to the given
locale.
- Parameters:
nothing - has to be null. Only for generic compatibility.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.
- Throws:
IOException - if the given Appendable caused such exception.
Copyright © 2001-2010 mmm-Team. All Rights Reserved.