MessageBundlepublic class MessageBundle extends Object Accept parameters for ProjectResourceBundle,
but defer object instantiation (and therefore
resource bundle loading) until required. |
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.String | getMessage(java.lang.String key)Gets a string message from the resource bundle for the given key
return getMessage(key, (String[]) null);
| public java.lang.String | getMessage(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}
return getMessage(key, new String[] { arg0 });
| public java.lang.String | getMessage(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}
return getMessage(key, new String[] { arg0, arg1 });
| public java.lang.String | getMessage(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}
return getMessage(key, new String[] { arg0, arg1, arg2 });
| public java.lang.String | getMessage(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}
return getMessage(key, new String[] { arg0, arg1, arg2, arg3 });
| public java.lang.String | getMessage(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}
return getMessage(key, new String[] { arg0, arg1, arg2, arg3, arg4 });
| public java.lang.String | getMessage(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}
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 ProjectResourceBundle | getResourceBundle()
if (!loaded) {
_resourceBundle = ProjectResourceBundle.getBundle(projectName,
packageName,
resourceName,
locale,
classLoader,
parent);
loaded = true;
}
return _resourceBundle;
|
|