org.apache.woden.internal
Class MessageFormatter

java.lang.Object
  extended by org.apache.woden.internal.MessageFormatter

public class MessageFormatter
extends java.lang.Object

This class is used for formatting error messages. Unformatted error messages are stored in a resource bundle. Formatting involves replacing any parameters in the unformatted message text with values supplied at invocation. The error messages may be translated into a localized resource bundle, so a locale may be specified to determine the localization required.

Author:
jkaputin@apache.org

Constructor Summary
MessageFormatter()
           
 
Method Summary
 java.lang.String formatMessage(java.util.Locale locale, java.lang.String key, java.lang.Object[] args, java.lang.String[] bundleNames)
          The specified key is used to retrieve an unformatted message from a resource bundle localized for the specified locale.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageFormatter

public MessageFormatter()
Method Detail

formatMessage

public java.lang.String formatMessage(java.util.Locale locale,
                                      java.lang.String key,
                                      java.lang.Object[] args,
                                      java.lang.String[] bundleNames)
The specified key is used to retrieve an unformatted message from a resource bundle localized for the specified locale. This text is then formatted with the specified message args.

Parameters:
locale - the required locale
key - the message key
args - message parameter values
Returns:
the formatted message text
Throws:
java.lang.NullPointerException - if key is null
java.util.MissingResourceException - if a resource bundle or the specified key cannot be found
java.lang.ClassCastException - if the object found for the specified key is not a string
java.lang.IllegalArgumentException - if the args don't match the message.


Copyright © 2005-2010 Apache Software Foundation. All Rights Reserved.