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)
           
MessageFormatter(org.apache.commons.logging.Log log, java.util.ResourceBundle bundle)
           
MessageFormatter(org.apache.commons.logging.Log log, 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
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(org.apache.commons.logging.Log log,
                        java.util.ResourceBundle bundle)

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)

MessageFormatter

public MessageFormatter(org.apache.commons.logging.Log log,
                        java.lang.String bundleName)
Method Detail

findMessage

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

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