org.apache.tapestry5.internal.services
Class DelegatingMessagesImpl

java.lang.Object
  extended by org.apache.tapestry5.internal.services.DelegatingMessagesImpl
All Implemented Interfaces:
Messages

public class DelegatingMessagesImpl
extends Object
implements Messages

Implementation of Messages that wraps two other Messages instances: a primary and a delegate. The primary handles any keys it contains; method invocations that reference keys not contained by the primary are passed on to the delegate.

Since:
5.2.0

Constructor Summary
DelegatingMessagesImpl(Messages primary, Messages delegate)
           
 
Method Summary
 boolean contains(String key)
          Returns true if the bundle contains the named key.
 String format(String key, Object... args)
          Convienience for accessing a formatter and formatting a localized message with arguments.
 String get(String key)
          Returns the localized message for the given key.
 MessageFormatter getFormatter(String key)
          Returns a formatter for the message, which can be used to substitute arguments (as per Formatter).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DelegatingMessagesImpl

public DelegatingMessagesImpl(Messages primary,
                              Messages delegate)
Method Detail

contains

public boolean contains(String key)
Description copied from interface: Messages
Returns true if the bundle contains the named key.

Specified by:
contains in interface Messages

format

public String format(String key,
                     Object... args)
Description copied from interface: Messages
Convienience for accessing a formatter and formatting a localized message with arguments.

Specified by:
format in interface Messages

get

public String get(String key)
Description copied from interface: Messages
Returns the localized message for the given key. If catalog does not contain such a key, then a modified version of the key is returned (converted to upper case and enclosed in brackets).

Specified by:
get in interface Messages
Returns:
localized message for key, or placeholder

getFormatter

public MessageFormatter getFormatter(String key)
Description copied from interface: Messages
Returns a formatter for the message, which can be used to substitute arguments (as per Formatter).

Specified by:
getFormatter in interface Messages
Returns:
formattable object


Copyright © 2003-2012 The Apache Software Foundation.