public class NlsMessageFormatterImpl extends AbstractNlsMessageFormatter
NlsMessageFormatter interface. 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. Appendable rather than only
on StringBuffer. It also uses the same Appendable for recursive invocations.| Modifier and Type | Class and Description |
|---|---|
protected static class |
NlsMessageFormatterImpl.PatternSegment
This inner class represents a segment out of the parsed message-pattern.
|
| Modifier and Type | Field and Description |
|---|---|
private NlsDependencies |
nlsDependnecies
The
NlsDependencies to use. |
private NlsMessageFormatterImpl.PatternSegment[] |
segments
The parsed segments of the message pattern.
|
private String |
suffix
The suffix (last segment) of the pattern.
|
SYNTAX| Constructor and Description |
|---|
NlsMessageFormatterImpl(String pattern,
NlsDependencies nlsDependencies)
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
format(Void nothing,
Locale locale,
Map<String,Object> arguments,
NlsTemplateResolver resolver,
Appendable buffer)
This method formats the underlying pattern by filling in the given
arguments and writing the result into
the given buffer. |
String |
getSuffix() |
void |
visit(Visitor<String> staticTextVisitor,
Visitor<NlsArgument> dynamicArgumentVisitor)
Visits the child elements of this
NlsMessageFormatter. |
formatcreateLogger, doInitialize, getLoggerdoInitialized, getInitializationState, initializeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitformatprivate final NlsMessageFormatterImpl.PatternSegment[] segments
private final String suffix
private final NlsDependencies nlsDependnecies
NlsDependencies to use.public NlsMessageFormatterImpl(String pattern, NlsDependencies nlsDependencies)
pattern - is the pattern of the message to format. It is syntax-compatible with
MessageFormat.nlsDependencies - are the NlsDependencies.public final void format(Void nothing, Locale locale, Map<String,Object> arguments, NlsTemplateResolver resolver, Appendable buffer) throws IOException
NlsMessageFormatterarguments and writing the result into
the given buffer.
This method formats the given object according to the given locale.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.IOException - if the given Appendable caused such exception.public String getSuffix()
NlsMessageFormatterImpl.PatternSegments.public void visit(Visitor<String> staticTextVisitor, Visitor<NlsArgument> dynamicArgumentVisitor)
NlsMessageFormatterNlsMessageFormatter.staticTextVisitor - a Visitor for the static text segments.dynamicArgumentVisitor - a Visitor for the NlsArguments.Copyright © 2001–2016 mmm-Team. All rights reserved.