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

## org.apache.muse.util.messages
Class Messages

    java.lang.Object
      org.apache.muse.util.messages.Messages

public class Messages
extends java.lang.Object

Messages is a wrapper for a java.util.ResourceBundle that provides a search-and-replace mechanism for filling in message context. Users can create properties files with messages that include XXX placeholders and then fill in the values of these placeholders at runtime. This allows for as much message externalization as possible while still making it easy to provide runtime-specific information.

Author:
  Dan Jemiolo (danj)
See Also:
  `MessagesFactory`, `ResourceBundle`

Constructor Summary
`Messages(java.lang.String bundleName)` Creates a new message collection using the given resource bundle.
`Messages(java.lang.String bundleName, java.lang.ClassLoader loader)` Creates a new message collection using the given resource bundle and classloader.

Method Summary
`java.lang.String` | `get(java.lang.String name)`
`java.lang.String` | `get(java.lang.String name, boolean includeID)`
`java.lang.String` | `get(java.lang.String name, java.lang.Object[] filler)` Retrieves the value specified and replaces any placeholders (XXX values) with the values in the given array.
`java.lang.String` | `get(java.lang.String name, java.lang.Object[] filler, boolean includeID)` Retrieves the value specified and replaces any placeholders (XXX values) with the values in the given array.

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

Constructor Detail

### Messages

    public Messages(java.lang.String bundleName)

  Creates a new message collection using the given resource bundle. The bundle (properties file) may contain XXX placeholders that indicate where values will be substituted at runtime.

Parameters:
  `bundleName` - The qualified name of the resource bundle to parse.

### Messages

    public Messages(java.lang.String bundleName,
                    java.lang.ClassLoader loader)

  Creates a new message collection using the given resource bundle and classloader. The bundle (properties file) may contain XXX placeholders that indicate where values will be substituted at runtime. This constructor is used by dependent bundles so that their resources can be found by the resource bundle.

Parameters:
  `bundleName` - The qualified name of the resource bundle to parse.
  `loader` - The class loader that has the bundle file in its classpath.

Method Detail

### get

    public java.lang.String get(java.lang.String name)

  Parameters:
    `name` - The name of the property/message to lookup.
  Returns:
    The message value, with a prefix that identifies the message name.

### get

    public java.lang.String get(java.lang.String name,
                                boolean includeID)

  Parameters:
    `name` - The name of the property/message to lookup.
    `includeID` - True if you want the message to include [ID = "MessageName"] for debugging purposes.
  Returns:
    The message value, with a prefix that identifies the message name.

### get

    public java.lang.String get(java.lang.String name,
                                java.lang.Object[] filler)

  Retrieves the value specified and replaces any placeholders (XXX values) with the values in the given array. The filler values are serialized using Object.toString().
  If the number of filler values is less than the number of placeholders, the placeholders will be left in the string. If the number of filler values is greater, the leftover values will simply not be used.

  Parameters:
    `name` - The name of the property/message to lookup.
    `filler` - The values to substitute for the placeholders (if any).
  Returns:
    The message value, with the given filler values substituted for the placeholders and a prefix that identifies the message name.

### get

    public java.lang.String get(java.lang.String name,
                                java.lang.Object[] filler,
                                boolean includeID)

  Retrieves the value specified and replaces any placeholders (XXX values) with the values in the given array. The filler values are serialized using Object.toString().
  If the number of filler values is less than the number of placeholders, the placeholders will be left in the string. If the number of filler values is greater, the leftover values will simply not be used.

  Parameters:
    `name` - The name of the property/message to lookup.
    `filler` - The values to substitute for the placeholders (if any).
    `includeID` - True if you want the message to include [ID = "MessageName"] for debugging purposes.
  Returns:
    The message value, with the given filler values substituted for the placeholders and a prefix that identifies the message name.

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