org.apache.hivemind.impl
Class MessagesImpl

java.lang.Object
  |
  +--org.apache.hivemind.impl.MessagesImpl
All Implemented Interfaces:
Messages

public final class MessagesImpl
extends java.lang.Object
implements Messages

Implementation of Messages for a Module.

Author:
Howard Lewis Ship

Constructor Summary
MessagesImpl(Resource moduleLocation, java.util.Locale locale)
           
 
Method Summary
 java.lang.String format(java.lang.String key, java.lang.Object arg0)
          Convienience method for invoking format(String, Object[]).
 java.lang.String format(java.lang.String key, java.lang.Object[] args)
          Formats a string, using MessageFormat.format(java.lang.String, java.lang.Object[]).
 java.lang.String format(java.lang.String key, java.lang.Object arg0, java.lang.Object arg1)
          Convienience method for invoking format(String, Object[]).
 java.lang.String format(java.lang.String key, java.lang.Object arg0, java.lang.Object arg1, java.lang.Object arg2)
          Convienience method for invoking format(String, Object[]).
 java.lang.String getMessage(java.lang.String key)
          Searches for a localized string with the given key.
 java.lang.String getMessage(java.lang.String key, java.lang.String defaultValue)
          Searches for a localized string with the given key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessagesImpl

public MessagesImpl(Resource moduleLocation,
                    java.util.Locale locale)
Method Detail

getMessage

public java.lang.String getMessage(java.lang.String key)
Description copied from interface: Messages
Searches for a localized string with the given key. If not found, a modified version of the key is returned (all upper-case and surrounded by square brackets).

Specified by:
getMessage in interface Messages

getMessage

public java.lang.String getMessage(java.lang.String key,
                                   java.lang.String defaultValue)
Description copied from interface: Messages
Searches for a localized string with the given key. If not found, then the default value (which should already be localized) is returned. Passing a default of null is useful when trying to determine if the strings contains a given key.

Specified by:
getMessage in interface Messages

format

public java.lang.String format(java.lang.String key,
                               java.lang.Object[] args)
Description copied from interface: Messages
Formats a string, using MessageFormat#format(java.lang.String, java.lang.Object[]).

Specified by:
format in interface Messages
Parameters:
key - the key used to obtain a localized pattern using Messages.getMessage(String)
args - passed to the formatter

format

public java.lang.String format(java.lang.String key,
                               java.lang.Object arg0)
Description copied from interface: Messages
Convienience method for invoking Messages.format(String, Object[]).

Specified by:
format in interface Messages

format

public java.lang.String format(java.lang.String key,
                               java.lang.Object arg0,
                               java.lang.Object arg1)
Description copied from interface: Messages
Convienience method for invoking Messages.format(String, Object[]).

Specified by:
format in interface Messages

format

public java.lang.String format(java.lang.String key,
                               java.lang.Object arg0,
                               java.lang.Object arg1,
                               java.lang.Object arg2)
Description copied from interface: Messages
Convienience method for invoking Messages.format(String, Object[]).

Specified by:
format in interface Messages