FileDocCategorySizeDatePackage
MessageBundle.javaAPI DocApache Axis 1.47747Sat Apr 22 18:57:28 BST 2006org.apache.axis.i18n

MessageBundle

public class MessageBundle extends Object
Accept parameters for ProjectResourceBundle, but defer object instantiation (and therefore resource bundle loading) until required.
author
Richard A. Sitze (rsitze@us.ibm.com)
author
Karl Moss (kmoss@macromedia.com)
author
Glen Daniels (gdaniels@apache.org)

Fields Summary
private boolean
loaded
private ProjectResourceBundle
_resourceBundle
private final String
projectName
private final String
packageName
private final String
resourceName
private final Locale
locale
private final ClassLoader
classLoader
private final ResourceBundle
parent
Constructors Summary
public MessageBundle(String projectName, String packageName, String resourceName, Locale locale, ClassLoader classLoader, ResourceBundle parent)
Construct a new ExtendMessages

        this.projectName = projectName;
        this.packageName = packageName;
        this.resourceName = resourceName;
        this.locale = locale;
        this.classLoader = classLoader;
        this.parent = parent;
    
Methods Summary
public java.lang.StringgetMessage(java.lang.String key)
Gets a string message from the resource bundle for the given key

param
key The resource key
return
The message

        return getMessage(key, (String[]) null);
    
public java.lang.StringgetMessage(java.lang.String key, java.lang.String arg0)

Gets a string message from the resource bundle for the given key. The message may contain variables that will be substituted with the given arguments. Variables have the format:

This message has two variables: {0} and {1}

param
key The resource key
param
arg0 The argument to place in variable {0}
return
The message

        return getMessage(key, new String[] { arg0 });
    
public java.lang.StringgetMessage(java.lang.String key, java.lang.String arg0, java.lang.String arg1)

Gets a string message from the resource bundle for the given key. The message may contain variables that will be substituted with the given arguments. Variables have the format:

This message has two variables: {0} and {1}

param
key The resource key
param
arg0 The argument to place in variable {0}
param
arg1 The argument to place in variable {1}
return
The message

        return getMessage(key, new String[] { arg0, arg1 });
    
public java.lang.StringgetMessage(java.lang.String key, java.lang.String arg0, java.lang.String arg1, java.lang.String arg2)

Gets a string message from the resource bundle for the given key. The message may contain variables that will be substituted with the given arguments. Variables have the format:

This message has two variables: {0} and {1}

param
key The resource key
param
arg0 The argument to place in variable {0}
param
arg1 The argument to place in variable {1}
param
arg2 The argument to place in variable {2}
return
The message

        return getMessage(key, new String[] { arg0, arg1, arg2 });
    
public java.lang.StringgetMessage(java.lang.String key, java.lang.String arg0, java.lang.String arg1, java.lang.String arg2, java.lang.String arg3)

Gets a string message from the resource bundle for the given key. The message may contain variables that will be substituted with the given arguments. Variables have the format:

This message has two variables: {0} and {1}

param
key The resource key
param
arg0 The argument to place in variable {0}
param
arg1 The argument to place in variable {1}
param
arg2 The argument to place in variable {2}
param
arg3 The argument to place in variable {3}
return
The message

        return getMessage(key, new String[] { arg0, arg1, arg2, arg3 });
    
public java.lang.StringgetMessage(java.lang.String key, java.lang.String arg0, java.lang.String arg1, java.lang.String arg2, java.lang.String arg3, java.lang.String arg4)

Gets a string message from the resource bundle for the given key. The message may contain variables that will be substituted with the given arguments. Variables have the format:

This message has two variables: {0} and {1}

param
key The resource key
param
arg0 The argument to place in variable {0}
param
arg1 The argument to place in variable {1}
param
arg2 The argument to place in variable {2}
param
arg3 The argument to place in variable {3}
param
arg4 The argument to place in variable {4}
return
The message

        return getMessage(key, new String[] { arg0, arg1, arg2, arg3, arg4 });
    
public java.lang.StringgetMessage(java.lang.String key, java.lang.String[] array)

Gets a string message from the resource bundle for the given key. The message may contain variables that will be substituted with the given arguments. Variables have the format:

This message has two variables: {0} and {1}

param
key The resource key
param
array An array of objects to place in corresponding variables
return
The message

        String msg = null;
        if (getResourceBundle() != null) {
            msg = getResourceBundle().getString(key);
        }

        if (msg == null) {
            throw new MissingResourceException("Cannot find resource key \"" + key +
                                               "\" in base name " +
                                               getResourceBundle().getResourceName(),
                                               getResourceBundle().getResourceName(), key);
        }

        return MessageFormat.format(msg, array);
    
public final ProjectResourceBundlegetResourceBundle()



        
        if (!loaded) {
            _resourceBundle = ProjectResourceBundle.getBundle(projectName,
                                                              packageName,
                                                              resourceName,
                                                              locale,
                                                              classLoader,
                                                              parent);
            loaded = true;
        }
        return _resourceBundle;