atg.commerce.gifts
Class GiftlistUserMessage

java.lang.Object
  extended by atg.commerce.gifts.GiftlistUserMessage

public class GiftlistUserMessage
extends java.lang.Object

This class encapsulates messages, configurable string constants and message formatting conventions. This class is used for client messages. These are messages displayed to a user when something is not correct. i.e. The user incorrectly types in the wrong information on a form.

This class obtains resource bundles based on a java.util.Locale object.

Usage:


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
static java.lang.String RESOURCE_BUNDLE
          Name of the resource
 
Constructor Summary
GiftlistUserMessage()
           
 
Method Summary
static java.lang.String format(java.lang.String pKey, java.util.Locale pLocale)
          Return a String message specific for the given locale.
static java.lang.String format(java.lang.String pKey, java.lang.Object[] pParams, java.util.Locale pLocale)
          Format a set of parameters into a message for a given locale
static java.lang.String format(java.lang.String pKey, java.lang.Object pParam, java.util.Locale pLocale)
          Format a single parameter into a message for a given locale
static java.text.MessageFormat getFormat(java.lang.String pKey, java.util.Locale pLocale)
          Return a MessageFormat from the resource bundle, for the given locale
static java.util.ResourceBundle getResourceBundle(java.util.Locale pLocale)
          Returns a ResourceBundle specific for the given locale
static java.lang.String getString(java.lang.String pKey, java.util.Locale pLocale)
          Return a String message specific for the given locale
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string


RESOURCE_BUNDLE

public static java.lang.String RESOURCE_BUNDLE
Name of the resource

Constructor Detail

GiftlistUserMessage

public GiftlistUserMessage()
Method Detail

getResourceBundle

public static java.util.ResourceBundle getResourceBundle(java.util.Locale pLocale)
                                                  throws java.util.MissingResourceException
Returns a ResourceBundle specific for the given locale

Parameters:
pLocale - the current locale
Returns:
pResourceBundle returns the resource bundle for a given locale
Throws:
java.util.MissingResourceException - if the resource bundle is missing

getString

public static java.lang.String getString(java.lang.String pKey,
                                         java.util.Locale pLocale)
Return a String message specific for the given locale

Parameters:
pKey - the identifier for the message to retrieve out of the ResourceBundle
pLocale - the locale of the user
Returns:
the localized message

getFormat

public static java.text.MessageFormat getFormat(java.lang.String pKey,
                                                java.util.Locale pLocale)
Return a MessageFormat from the resource bundle, for the given locale

Parameters:
pLocale - the locale of the user
pKey - the identifier for the message to retrieve out of the ResourceBundle
Returns:
the localized message format

format

public static java.lang.String format(java.lang.String pKey,
                                      java.util.Locale pLocale)
Return a String message specific for the given locale.
note: functionaly equivalent to getString

Parameters:
pKey - the identifier for the message to retrieve out of the ResourceBundle
pLocale - the locale of the user
Returns:
the localized message

format

public static java.lang.String format(java.lang.String pKey,
                                      java.lang.Object pParam,
                                      java.util.Locale pLocale)
Format a single parameter into a message for a given locale

Parameters:
pKey - the identifier for the message to retrieve out of the ResourceBundle
pParam - a single parameter to use in formatting
pLocale - the locale of the user
Returns:
the localized and formatted message

format

public static java.lang.String format(java.lang.String pKey,
                                      java.lang.Object[] pParams,
                                      java.util.Locale pLocale)
Format a set of parameters into a message for a given locale

Parameters:
pKey - the identifier for the message to retrieve out of the ResourceBundle
pParams - a set of parameters to use in the formatting
pLocale - the locale of the user
Returns:
the localized and formatted message