org.clapper.util.misc
Class BundleUtil

java.lang.Object
  extended by org.clapper.util.misc.BundleUtil

public final class BundleUtil
extends java.lang.Object

ResourceBundle utilities to aid in localization.

Version:
$Revision: 6932 $
Author:
Copyright © 2004-2007 Brian M. Clapper

Method Summary
static java.lang.String getMessage(java.lang.String bundleName, java.util.Locale locale, java.lang.String key, java.lang.Object[] params)
          Get a localized message from the bundle.
static java.lang.String getMessage(java.lang.String bundleName, java.util.Locale locale, java.lang.String key, java.lang.String defaultMsg)
          Get a localized message from a bundle.
static java.lang.String getMessage(java.lang.String bundleName, java.util.Locale locale, java.lang.String key, java.lang.String defaultMsg, java.lang.Object[] params)
          Get a localized message from the bundle.
static java.lang.String getMessage(java.lang.String bundleName, java.lang.String key, java.lang.Object[] params)
          Get a message from the bundle using the default locale.
static java.lang.String getString(java.lang.String bundleName, java.lang.String key)
          Get a string from a bundle, using the default locale.
static java.lang.String getString(java.lang.String bundleName, java.lang.String key, java.lang.String defaultMsg)
          Get a string from a bundle, using the default locale.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getString

public static java.lang.String getString(java.lang.String bundleName,
                                         java.lang.String key)
Get a string from a bundle, using the default locale.

Parameters:
bundleName - the bundle name
key - the key to look up
Returns:
the value for the key, or the default value

getString

public static java.lang.String getString(java.lang.String bundleName,
                                         java.lang.String key,
                                         java.lang.String defaultMsg)
Get a string from a bundle, using the default locale.

Parameters:
bundleName - the bundle name
key - the key to look up
defaultMsg - the default value, or null
Returns:
the value for the key, or the default value

getMessage

public static java.lang.String getMessage(java.lang.String bundleName,
                                          java.util.Locale locale,
                                          java.lang.String key,
                                          java.lang.String defaultMsg)
Get a localized message from a bundle.

Parameters:
bundleName - the name of the resource bundle
locale - the locale
key - the key
defaultMsg - the default message
Returns:
the message, or the default

getMessage

public static java.lang.String getMessage(java.lang.String bundleName,
                                          java.lang.String key,
                                          java.lang.Object[] params)
Get a message from the bundle using the default locale.

Parameters:
bundleName - the name of the resource bundle
key - the key
params - parameters for the message
Returns:
the message, or the default

getMessage

public static java.lang.String getMessage(java.lang.String bundleName,
                                          java.util.Locale locale,
                                          java.lang.String key,
                                          java.lang.String defaultMsg,
                                          java.lang.Object[] params)
Get a localized message from the bundle.

Parameters:
bundleName - the name of the resource bundle
locale - the locale
key - the key
defaultMsg - the default message
params - parameters for the message
Returns:
the message, or the default

getMessage

public static java.lang.String getMessage(java.lang.String bundleName,
                                          java.util.Locale locale,
                                          java.lang.String key,
                                          java.lang.Object[] params)
Get a localized message from the bundle.

Parameters:
bundleName - the name of the resource bundle
locale - the locale
key - the key
params - parameters for the message
Returns:
the message, or the default


Copyright © 2004-2007 Brian M. Clapper. All Rights Reserved.