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
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

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

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

String format(String key,
              Object[] arguments)
Formats a string, using MessageFormat.format(java.lang.String, java.lang.Object[]).

In addition, special processing occurs for any of the arguments that inherit from Throwable: such arguments are replaced with the Throwable's message (if non blank), or the Throwable's class name (if the message is blank).

Parameters:
key - the key used to obtain a localized pattern using getMessage(String)
arguments - passed to the formatter
Since:
3.0

format

String format(String key,
              Object argument)
Convienience method for invoking format(String, Object[]).

Since:
3.0

format

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

Since:
3.0

format

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

Since:
3.0