org.apache.hivemind.impl
Class MessageFormatter

java.lang.Object
  extended by org.apache.hivemind.impl.AbstractMessages
      extended by org.apache.hivemind.impl.MessageFormatter
All Implemented Interfaces:
Messages

public class MessageFormatter
extends AbstractMessages

A wrapper around ResourceBundle that makes it easier to access and format messages.

Author:
Howard Lewis Ship

Constructor Summary
MessageFormatter(java.lang.Class referenceClass)
          Assumes that the bundle name is the same as the reference class, with "Messages" stripped off, and "Strings" appended.
MessageFormatter(java.lang.Class referenceClass, java.lang.String name)
           
MessageFormatter(org.apache.commons.logging.Log log, java.lang.Class referenceClass, java.lang.String name)
          Deprecated. in 1.2, to be removed in a later release. Use MessageFormatter(Class, String) instead.
MessageFormatter(org.apache.commons.logging.Log log, java.util.ResourceBundle bundle)
          Deprecated. in 1.2, to be removed in a later release. Use MessageFormatter(ResourceBundle) instead.
MessageFormatter(org.apache.commons.logging.Log log, java.lang.String bundleName)
          Deprecated. in 1.2, to be removed in a later release. Use MessageFormatter(String) instead.
MessageFormatter(java.util.ResourceBundle bundle)
           
MessageFormatter(java.lang.String bundleName)
           
 
Method Summary
protected  java.lang.String findMessage(java.lang.String key)
          Concrete implementations must implement this method.
protected  java.util.Locale getLocale()
          Concrete implementations must provide a non-null Locale.
 
Methods inherited from class org.apache.hivemind.impl.AbstractMessages
containsMessage, format, format, format, format, getMessage
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageFormatter

public MessageFormatter(java.util.ResourceBundle bundle)

MessageFormatter

public MessageFormatter(org.apache.commons.logging.Log log,
                        java.util.ResourceBundle bundle)
Deprecated. in 1.2, to be removed in a later release. Use MessageFormatter(ResourceBundle) instead.


MessageFormatter

public MessageFormatter(java.lang.Class referenceClass)
Assumes that the bundle name is the same as the reference class, with "Messages" stripped off, and "Strings" appended.

Since:
1.1

MessageFormatter

public MessageFormatter(java.lang.Class referenceClass,
                        java.lang.String name)

MessageFormatter

public MessageFormatter(org.apache.commons.logging.Log log,
                        java.lang.Class referenceClass,
                        java.lang.String name)
Deprecated. in 1.2, to be removed in a later release. Use MessageFormatter(Class, String) instead.


MessageFormatter

public MessageFormatter(java.lang.String bundleName)

MessageFormatter

public MessageFormatter(org.apache.commons.logging.Log log,
                        java.lang.String bundleName)
Deprecated. in 1.2, to be removed in a later release. Use MessageFormatter(String) instead.

Method Detail

findMessage

protected java.lang.String findMessage(java.lang.String key)
Description copied from class: AbstractMessages
Concrete implementations must implement this method.

Note: starting with release 1.2, it is no longer considered an error if the key does not match a known message (i.e., due to AbstractMessages.containsMessage(String)). Prior to 1.2, some implementations would log an error in that situation.

Specified by:
findMessage in class AbstractMessages
Returns:
the localized message for the key, or null if no such message exists.

getLocale

protected java.util.Locale getLocale()
Description copied from class: AbstractMessages
Concrete implementations must provide a non-null Locale.

Specified by:
getLocale in class AbstractMessages


Copyright © 2003-2007 Apache Software Foundation. All Rights Reserved.