org.apache.tapestry
Interface IMessages

All Known Implementing Classes:
ComponentMessages

public interface IMessages

A set of localized message strings. This is somewhat like a ResourceBundle, but with more flexibility about where the messages come from. In addition, it includes methods similar to MessageFormat for formatting the strings.

Since:
2.0.4
Version:
$Id: IMessages.java,v 1.2 2003/09/04 15:45:38 ehatcher Exp $
Author:
Howard Lewis Ship
See Also:
IComponent.getMessages(), IComponentMessagesSource

Method Summary
 String format(String key, Object argument)
          Convienience method for invoking format(String, Object[]).
 String format(String key, Object[] arguments)
          Formats a string, using MessageFormat.format(java.lang.String, java.lang.Object[]).
 String format(String key, Object argument1, Object argument2)
          Convienience method for invoking format(String, Object[]).
 String format(String key, Object argument1, Object argument2, Object argument3)
          Convienience method for invoking format(String, Object[]).
 String getMessage(String key)
          Searches for a localized string with the given key.
 String getMessage(String key, String defaultValue)
          Searches for a localized string with the given key.
 

Method Detail

getMessage

public String getMessage(String key)
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).

getMessage

public String getMessage(String key,
                         String defaultValue)
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.

format

public String format(String key,
                     Object[] arguments)
Formats a string, using MessageFormat.format(java.lang.String, java.lang.Object[]).
Parameters:
key - the key used to obtain a localized pattern using getMessage(String)
arguments - passed to the formatter
Since:
3.0

format

public String format(String key,
                     Object argument)
Convienience method for invoking format(String, Object[]).
Since:
3.0

format

public String format(String key,
                     Object argument1,
                     Object argument2)
Convienience method for invoking format(String, Object[]).
Since:
3.0

format

public String format(String key,
                     Object argument1,
                     Object argument2,
                     Object argument3)
Convienience method for invoking format(String, Object[]).
Since:
3.0