org.dbforms.util
Class MessageResources

java.lang.Object
  extended by org.dbforms.util.MessageResources

public class MessageResources
extends Object

base class for handling messages

Author:
Henner Kollmann

Field Summary
static String LOCALE_KEY
          DOCUMENT ME!
 
Constructor Summary
MessageResources()
           
 
Method Summary
static Locale getLocale(HttpServletRequest request)
          DOCUMENT ME!
static String getMessage(HttpServletRequest request, String msg)
          Get the message from ResourceBundle.
static String getMessage(String msg, Locale loc)
          Retrieve message from ResourceBundle.
static String getMessage(String msg, Locale locale, String defaultMsg)
          Get the message from ResourceBundle.
static String getMessage(String msg, Locale loc, String[] parms)
          Retrieve message from ResourceBundle and replace parameter "{x}" with values in parms array.
static void setLocale(HttpServletRequest request, Locale locale)
          DOCUMENT ME!
static void setSubClass(String subClass)
          DOCUMENT ME!
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOCALE_KEY

public static String LOCALE_KEY
DOCUMENT ME!

Constructor Detail

MessageResources

public MessageResources()
Method Detail

setLocale

public static void setLocale(HttpServletRequest request,
                             Locale locale)
DOCUMENT ME!

Parameters:
request - DOCUMENT ME!
locale - DOCUMENT ME!

getLocale

public static Locale getLocale(HttpServletRequest request)
DOCUMENT ME!

Parameters:
request - DOCUMENT ME!
Returns:
DOCUMENT ME!

getMessage

public static String getMessage(HttpServletRequest request,
                                String msg)
Get the message from ResourceBundle. If not present, return the defaultMsg at the place of a null.

Parameters:
request - DOCUMENT ME!
msg - DOCUMENT ME!
Returns:
DOCUMENT ME!

getMessage

public static String getMessage(String msg,
                                Locale locale,
                                String defaultMsg)
Get the message from ResourceBundle. If not present, return the defaultMsg at the place of a null. To avoid to doing this condition everywhere in the code ...

Parameters:
msgString - : Message key to lookup.
localeLocale - : Locale object to map message with good ResourceBundle.
defaultMsgString - : String to return if the lookup message key is not found.
Returns:
String : Message resolve.

getMessage

public static String getMessage(String msg,
                                Locale loc)
Retrieve message from ResourceBundle. If the ResourceBundle is not yet cached, cache it and retreive message.

Parameters:
msgString - : Message key to lookup.
locLocale - : Locale object to map message with good ResourceBundle.
Returns:
String : Message resolve, null if not found.

getMessage

public static String getMessage(String msg,
                                Locale loc,
                                String[] parms)
Retrieve message from ResourceBundle and replace parameter "{x}" with values in parms array.

Parameters:
msgString - : Message key to lookup.
locLocale - : Locale object to map message with good ResourceBundle.
parmsString[] - : Parameters to replace "{x}" in message .
Returns:
String : Message resolve with parameter replaced, null if message key not found.

setSubClass

public static void setSubClass(String subClass)
DOCUMENT ME!

Parameters:
subClass - DOCUMENT ME!


Copyright © 2002-2006 DbForms. All Rights Reserved.