com.anthonyeden.lib.util
Class MessageUtilities

java.lang.Object
  extended bycom.anthonyeden.lib.util.MessageUtilities

public class MessageUtilities
extends java.lang.Object

Utilities for retrieving localized messages.

Author:
Anthony Eden

Method Summary
static java.lang.String getMessage(java.lang.Class c, java.lang.String pkg, java.lang.String name, java.lang.Object[] args)
          Locate the given message and merge it with the given arguments using the MessageFormat class.
static java.lang.String getMessage(java.lang.Class c, java.lang.String pkg, java.lang.String name, java.lang.Object[] args, java.util.Locale locale)
          Locate the given message and merge it with the given arguments using the MessageFormat class.
static java.lang.String getMessage(java.lang.String pkg, java.lang.String name, java.lang.Object[] args)
          Locate the given message and merge it with the given arguments using the MessageFormat class.
static java.lang.String getMessage(java.lang.String pkg, java.lang.String name, java.lang.Object[] args, java.util.Locale locale)
          Locate the given message and merge it with the given arguments using the MessageFormat class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getMessage

public static java.lang.String getMessage(java.lang.String pkg,
                                          java.lang.String name,
                                          java.lang.Object[] args)
Locate the given message and merge it with the given arguments using the MessageFormat class. This method uses ResourceBundle to locate a bundle called org.jpublish.messages and then pulls the appropriate message.

Parameters:
name - The message name
args - The arguments
Returns:
The message

getMessage

public static java.lang.String getMessage(java.lang.String pkg,
                                          java.lang.String name,
                                          java.lang.Object[] args,
                                          java.util.Locale locale)
Locate the given message and merge it with the given arguments using the MessageFormat class. This method uses ResourceBundle to locate a bundle called org.jpublish.messages and then pulls the appropriate message.

The pkg argument is used to prepend a package name to the bundle name so that different JARs can have different bundles. For example, if pkg is com.foo then the Bundle should be located by the classloader at com/foo/messages.properties. pkg can be null in which case /messages.properties will be used.

Parameters:
pkg - The package
name - The message name
args - The arguments
locale - The Locale
Returns:
The message

getMessage

public static java.lang.String getMessage(java.lang.Class c,
                                          java.lang.String pkg,
                                          java.lang.String name,
                                          java.lang.Object[] args)
Locate the given message and merge it with the given arguments using the MessageFormat class. This method uses ResourceBundle to locate a bundle called org.jpublish.messages and then pulls the appropriate message. The actual message key is determined by concatenating the class name and the name parameter.

Parameters:
c - The requesting class
pkg - The package name
name - The message name
args - The arguments
Returns:
The message

getMessage

public static java.lang.String getMessage(java.lang.Class c,
                                          java.lang.String pkg,
                                          java.lang.String name,
                                          java.lang.Object[] args,
                                          java.util.Locale locale)
Locate the given message and merge it with the given arguments using the MessageFormat class. This method uses ResourceBundle to locate a bundle called org.jpublish.messages and then pulls the appropriate message. The actual message key is determined by concatenating the class name and the name parameter.

Parameters:
c - The requesting Class
name - The message name
args - The arguments
locale - The locale
Returns:
The message


Copyright (c) 2000-2003 Anthony Eden. All Rights Reserved.