Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.tapestry5.ioc.util
Class AbstractMessages

    java.lang.Object
      org.apache.tapestry5.ioc.util.AbstractMessages

All Implemented Interfaces:
  Messages

Direct Known Subclasses:
  MapMessages, MessagesImpl

    public abstract class AbstractMessages

extends java.lang.Object
implements Messages

Abstract implementation of `Messages` that doesn't know where values come from (that information is supplied in a subclass, via the `valueForKey(String)` method).

Constructor Summary
`protected` | `AbstractMessages(java.util.Locale locale)`

Method Summary
`boolean` | `contains(java.lang.String key)` Returns true if the bundle contains the named key.
`java.lang.String` | `format(java.lang.String key, java.lang.Object... args)` Convienience for accessing a formatter and formatting a localized message with arguments.
`java.lang.String` | `get(java.lang.String key)` Returns the localized message for the given key.
`MessageFormatter` | `getFormatter(java.lang.String key)` Returns a formatter for the message, which can be used to substitute arguments (as per `Formatter`).
`protected abstract java.lang.String` | `valueForKey(java.lang.String key)` Invoked to provide the value for a particular key.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### AbstractMessages

    protected AbstractMessages(java.util.Locale locale)

Method Detail

### valueForKey

    protected abstract java.lang.String valueForKey(java.lang.String key)

  Invoked to provide the value for a particular key. This may be invoked multiple times even for the same key. The implementation should ignore the case of the key.

  Parameters:
    `key` - the key to obtain a value for (case insensitive)
  Returns:
    the value for the key, or null if this instance can not provide the value

### contains

    public boolean contains(java.lang.String key)

  Description copied from interface: `Messages`
  Returns true if the bundle contains the named key.

  Specified by:
    `contains` in interface `Messages`

### get

    public java.lang.String get(java.lang.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(java.lang.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

### format

    public java.lang.String format(java.lang.String key,
                                   java.lang.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`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2012 The Apache Software Foundation.