FileDocCategorySizeDatePackage
I18NHelper.javaAPI DocGlassfish v2 API5474Fri May 04 22:35:20 BST 2007com.sun.jdo.spi.persistence.utility

I18NHelper

public class I18NHelper extends Object

Fields Summary
private static final String
bundleSuffix
private static Hashtable
bundles
private static Locale
locale
Constructors Summary
public I18NHelper()
Constructor


	 	 
  	  
  	
Methods Summary
public static final java.lang.StringgetMessage(java.util.ResourceBundle messages, java.lang.String messageKey, java.lang.Object arg)
Formats message by adding an Object as an argument

    		Object []args = {arg};
    		return getMessage(messages, messageKey, args);
  	
public static final java.lang.StringgetMessage(java.util.ResourceBundle messages, java.lang.String messageKey, int arg)
Formats message by adding an int as an argument

    		Object []args = {new Integer(arg)};
    		return getMessage(messages, messageKey, args);
  	
public static final java.lang.StringgetMessage(java.util.ResourceBundle messages, java.lang.String messageKey, boolean arg)
Formats message by adding a boolean as an argument

    		Object []args = {String.valueOf(arg)};
    		return getMessage(messages, messageKey, args);
  	
public static final java.lang.StringgetMessage(java.util.ResourceBundle messages, java.lang.String messageKey)
Returns message as String

    		return messages.getString(messageKey);
  	
public static final java.lang.StringgetMessage(java.util.ResourceBundle messages, java.lang.String messageKey, java.lang.Object[] msgArgs)
Formats message by adding Array of arguments

    		for (int i=0; i<msgArgs.length; i++) {
        		if (msgArgs[i] == null) msgArgs[i] = ""; // NOI18N
    		}
    		MessageFormat formatter = new MessageFormat(messages.getString(messageKey));
    		return formatter.format(msgArgs);
  	
public static final java.lang.StringgetMessage(java.util.ResourceBundle messages, java.lang.String messageKey, java.lang.String arg)
Formats message by adding a String argument

    		Object []args = {arg};
    		return getMessage(messages, messageKey, args);
  	
public static final java.lang.StringgetMessage(java.util.ResourceBundle messages, java.lang.String messageKey, java.lang.String arg1, java.lang.String arg2)
Formats message by adding two String arguments

    		Object []args = {arg1, arg2};
    		return getMessage(messages, messageKey, args);
  	
public static final java.lang.StringgetMessage(java.util.ResourceBundle messages, java.lang.String messageKey, java.lang.String arg1, java.lang.String arg2, java.lang.String arg3)
Formats message by adding three String arguments

    		Object []args = {arg1, arg2, arg3};
    		return getMessage(messages, messageKey, args);
  	
public static java.util.ResourceBundleloadBundle(java.lang.String bundleName)
Load ResourceBundle by bundle name

		return loadBundle(bundleName, I18NHelper.class.getClassLoader());
  	
public static java.util.ResourceBundleloadBundle(java.lang.String bundleName, java.lang.ClassLoader loader)
Load ResourceBundle by bundle name and class loader

      		ResourceBundle messages = (ResourceBundle)bundles.get(bundleName);

    		if (messages == null) //not found as loaded - add
		{
      			messages = ResourceBundle.getBundle(bundleName, locale, loader);
			bundles.put(bundleName, messages);
    		}
		return messages;
  	
public static java.util.ResourceBundleloadBundle(java.lang.Class classObject)
Load ResourceBundle by class object - figure out the bundle name for the class object's package and use the class' class loader.

		return loadBundle(
    		JavaTypeHelper.getPackageName(classObject.getName()) + bundleSuffix,
    		classObject.getClassLoader());