|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.zilonis.tool.ext.aerith.util.Bundles
public class Bundles
Convenience class permitting easy loading of localized resources of various sorts. Extends the functionality of the default Java resource support, and interacts better with class loaders in a multiple-loader system.
Example usage:
package com.mycom;
public class Foo {
// Search for tag Foo_theMessage in /com/mycom/Bundle.properties:
private static String theMessage = NbBundle.getMessage (Foo.class, "Foo_theMessage");
// Might also look in /com/mycom/Bundle_de.properties, etc.
}
| Method Summary | |
|---|---|
static java.util.ResourceBundle |
getBundle(java.lang.Class clazz)
Get a resource bundle in the same package as the provided class, with the default locale/branding and the class' own classloader. |
static java.util.ResourceBundle |
getBundle(java.lang.String baseName)
Get a resource bundle with the default class loader and locale/branding. |
static java.util.ResourceBundle |
getBundle(java.lang.String baseName,
java.util.Locale locale)
Get a resource bundle with the default class loader and branding. |
static java.util.ResourceBundle |
getBundle(java.lang.String baseName,
java.util.Locale locale,
java.lang.ClassLoader loader)
Get a resource bundle the hard way. |
static java.lang.String |
getMessage(java.lang.Class clazz,
java.lang.String resName)
Finds a localized and/or branded string in a bundle. |
static java.lang.String |
getMessage(java.lang.Class clazz,
java.lang.String resName,
java.lang.Object... params)
Finds a localized and/or branded string in a bundle and formats the message by passing requested parameters. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static final java.util.ResourceBundle getBundle(java.lang.String baseName)
throws java.util.MissingResourceException
getBundle(Class) is generally
safer when used from a module as this method relies on the module's
classloader to currently be part of the system classloader. The
IDE does add enabled modules to this classloader, however calls to
this variant of the method made in
public static java.util.ResourceBundle getBundle(java.lang.Class clazz)
throws java.util.MissingResourceException
clazz - the class to take the package name from
java.util.MissingResourceException - if the bundle does not exist
public static final java.util.ResourceBundle getBundle(java.lang.String baseName,
java.util.Locale locale)
throws java.util.MissingResourceException
baseName - bundle basenamelocale - the locale to use (but still uses default branding)
java.util.MissingResourceException - if the bundle does not exist
public static final java.util.ResourceBundle getBundle(java.lang.String baseName,
java.util.Locale locale,
java.lang.ClassLoader loader)
throws java.util.MissingResourceException
baseName - bundle basenamelocale - the locale to use (but still uses default branding)loader - the class loader to use
java.util.MissingResourceException - if the bundle does not exist
public static java.lang.String getMessage(java.lang.Class clazz,
java.lang.String resName)
throws java.util.MissingResourceException
clazz - the class to use to locate the bundleresName - name of the resource to look for
java.util.MissingResourceException - if either the bundle or the string cannot be found
public static java.lang.String getMessage(java.lang.Class clazz,
java.lang.String resName,
java.lang.Object... params)
throws java.util.MissingResourceException
clazz - the class to use to locate the bundleresName - name of the resource to look forparams - array of parameters to use for formatting the message
java.util.MissingResourceException - if either the bundle or the string cannot be foundMessageFormat.format(String,Object[])
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||