net.sf.mmm.util.nls.impl
Class NlsMessageImpl

java.lang.Object
  extended by net.sf.mmm.util.nls.base.AbstractNlsMessage
      extended by net.sf.mmm.util.nls.base.BasicNlsMessage
          extended by net.sf.mmm.util.nls.impl.NlsMessageImpl
All Implemented Interfaces:
NlsMessage, NlsObject

public class NlsMessageImpl
extends BasicNlsMessage

This is the implementation of NlsMessage.

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

Field Summary
private  NlsDependencies nlsDependencies
           
 
Fields inherited from class net.sf.mmm.util.nls.base.AbstractNlsMessage
LOCALE_ROOT
 
Fields inherited from interface net.sf.mmm.util.nls.api.NlsMessage
LOCALIZATION_FAILURE_PREFIX
 
Fields inherited from interface net.sf.mmm.util.nls.api.NlsObject
KEY_ANNOTATION, KEY_ARGUMENT, KEY_CAPACITY, KEY_DEFAULT, KEY_DIRECTORY, KEY_ERROR, KEY_FILE, KEY_FUNCTION, KEY_ID, KEY_KEY, KEY_LOCATION, KEY_MAX, KEY_MIN, KEY_MODE, KEY_NAME, KEY_OBJECT, KEY_OPERAND, KEY_OPERATION, KEY_OPTION, KEY_PATH, KEY_PROPERTY, KEY_QUERY, KEY_RESOURCE, KEY_SIZE, KEY_SOURCE, KEY_TARGET_TYPE, KEY_TITLE, KEY_TYPE, KEY_URI, KEY_VALUE
 
Constructor Summary
NlsMessageImpl(NlsTemplate template, Map<String,Object> messageArguments, NlsDependencies nlsDependencies)
          The constructor.
NlsMessageImpl(String internationalizedMessage, Map<String,Object> messageArguments, NlsDependencies nlsDependencies)
          The constructor.
 
Method Summary
 void getLocalizedMessage(Locale locale, NlsTemplateResolver resolver, Appendable buffer)
          This method writes the localized message to the given buffer.
 String getMessage()
          This method gets the untranslated message (default language should be English) with arguments filled in.
protected  NlsDependencies getNlsDependencies()
           
 NlsMessage toNlsMessage()
          This method is the equivalent to Object.toString() with native language support.
 String toString()
          
 
Methods inherited from class net.sf.mmm.util.nls.base.BasicNlsMessage
getArgument, getArguments, getInternationalizedMessage, getTemplate, getTemplate
 
Methods inherited from class net.sf.mmm.util.nls.base.AbstractNlsMessage
getArgument, getArgumentCount, getLocalizedMessage, getLocalizedMessage, getLocalizedMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

nlsDependencies

private final NlsDependencies nlsDependencies
See Also:
getNlsDependencies()
Constructor Detail

NlsMessageImpl

public NlsMessageImpl(NlsTemplate template,
                      Map<String,Object> messageArguments,
                      NlsDependencies nlsDependencies)
The constructor.

Parameters:
template - is the NlsTemplate for the raw message.
messageArguments - are the arguments filled into the message after nationalization.
nlsDependencies - are the NlsDependencies to use.

NlsMessageImpl

public NlsMessageImpl(String internationalizedMessage,
                      Map<String,Object> messageArguments,
                      NlsDependencies nlsDependencies)
The constructor.

Parameters:
internationalizedMessage - is the internationalized message.
messageArguments - are the arguments filled into the message after nationalization.
nlsDependencies - are the NlsDependencies to use.
Method Detail

getNlsDependencies

protected NlsDependencies getNlsDependencies()
Returns:
the NlsDependencies.

getLocalizedMessage

public void getLocalizedMessage(Locale locale,
                                NlsTemplateResolver resolver,
                                Appendable buffer)
This method writes the localized message to the given buffer.
The actual localization is done by a template that is provided via the given resolver. If this fails, the original message will be used. After translation is done, the language independent arguments will be filled in the translated message string according to the given locale.

Parameters:
locale - is the locale to translate to.
resolver - is used to resolve the template required to translate the internationalized message.
buffer - is the buffer where to write the message to.

getMessage

public String getMessage()
This method gets the untranslated message (default language should be English) with arguments filled in.

Specified by:
getMessage in interface NlsMessage
Overrides:
getMessage in class AbstractNlsMessage
Returns:
the i18n message with arguments filled in.
See Also:
NlsMessage.getLocalizedMessage(Locale, NlsTemplateResolver)

toNlsMessage

public NlsMessage toNlsMessage()
This method is the equivalent to Object.toString() with native language support.

Specified by:
toNlsMessage in interface NlsObject
Overrides:
toNlsMessage in class AbstractNlsMessage
Returns:
an nls message representing this object.

toString

public String toString()

Overrides:
toString in class AbstractNlsMessage


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