|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.ge.research.app.LocaleNegotiator
This class is used to manage the discovery and loading of locale specific
resources, based upon the supplied preferences of a single Locale to use
or an ordered Enumeration of preferred Locales
to use. If the LocaleNegotiator is constructed with an Enumeration
of Locale objects, when loading resources, it attempts to find the best match of
available resources based upon all of the specified Locales, with regard to
their specified relative preferences.
| Field Summary | |
protected java.util.logging.Logger |
logger
Logging utility for this class |
| Constructor Summary | |
LocaleNegotiator()
Constructs a LocaleNegotiator object for the
JVM default Locale and the ClassLoader
of this class. |
|
LocaleNegotiator(java.util.Enumeration locales)
Constructs a LocaleNegotiator object for the
specified Locales within the Enumeration
and the ClassLoader of this class. |
|
LocaleNegotiator(java.util.Locale locale)
Constructs a LocaleNegotiator object for the
specified Locale and the ClassLoader
of this class. |
|
| Method Summary | |
boolean |
equals(java.lang.Object o)
A LocaleNegotiator is considered equal to
another LocaleNegotiator if the com.ge.research.app.LocaleNegotiator#locales property
are the same Enumeration of Locales.
|
protected java.util.Locale |
getLocale()
Returns the Locale to use to find and load resources.
|
protected java.util.Enumeration |
getLocales()
Returns the ordered set of preferred Locales to use to find and load resources |
java.util.ResourceBundle |
getResourceBundle(java.lang.String baseName)
Attempts to find the best match of a locale specific resource for argument baseName
given the preferred Locales specified in the com.ge.research.app.LocaleNegotiator#locales property
or by the com.ge.research.app.LocaleNegotiator#locale property. |
protected int |
scoreMatch(java.util.Locale locale1,
java.util.Locale locale2)
Compares two Locale objects to each other and generates a score
representing their similarity.
|
void |
setClassLoader(java.lang.ClassLoader classLoader)
Sets the ClassLoader to use when attempting to
find and load resource bundles. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected final java.util.logging.Logger logger
| Constructor Detail |
public LocaleNegotiator()
LocaleNegotiator object for the
JVM default Locale and the ClassLoader
of this class.
setClassLoader(java.lang.ClassLoader)public LocaleNegotiator(java.util.Locale locale)
LocaleNegotiator object for the
specified Locale and the ClassLoader
of this class.
LocaleNegotiator()public LocaleNegotiator(java.util.Enumeration locales)
LocaleNegotiator object for the
specified Locales within the Enumeration
and the ClassLoader of this class.
LocaleNegotiator()| Method Detail |
public boolean equals(java.lang.Object o)
LocaleNegotiator is considered equal to
another LocaleNegotiator if the com.ge.research.app.LocaleNegotiator#locales property
are the same Enumeration of Locales.
Or if both locales properties are null then the objects are equivalent if their
com.ge.research.app.LocaleNegotiator#locale properties are equal.
public java.util.ResourceBundle getResourceBundle(java.lang.String baseName)
throws java.lang.IllegalArgumentException,
java.util.MissingResourceException
baseName
given the preferred Locales specified in the com.ge.research.app.LocaleNegotiator#locales property
or by the com.ge.research.app.LocaleNegotiator#locale property.
baseName - the base name (without locale information) of the resource to find the locale specific instance of
baseName.
The locale specific instance is resolved by the procedure defined by ResourceBundle.getBundle(java.lang.String, java.util.Locale, java.lang.ClassLoader)
java.lang.IllegalArgumentException - if the baseName argument is null or the empty string
java.util.MissingResourceException - if no resource bundle for the argument baseName can be found
using the procedure for resolving locale specific resources set forth by ResourceBundle.getBundle(java.lang.String, java.util.Locale, java.lang.ClassLoader)ResourceBundle.getBundle(java.lang.String, java.util.Locale, java.lang.ClassLoader)public void setClassLoader(java.lang.ClassLoader classLoader)
ClassLoader to use when attempting to
find and load resource bundles. If ClassLoader is
null then the ClassLoader of this class
is used by default.
classLoader - the ClassLoader to use when loading resource bundlesprotected final java.util.Locale getLocale()
Locale to use to find and load resources.
If the com.ge.research.app.LocaleNegotiator#locales property is set,
the com.ge.research.app.LocaleNegotiator#locale property is meaningless.
Locale to use to find and load resources,
unless the locales property is set.protected final java.util.Enumeration getLocales()
Locales to use to find and load resources
Locales to use to find and load resources
protected final int scoreMatch(java.util.Locale locale1,
java.util.Locale locale2)
Locale objects to each other and generates a score
representing their similarity.
A score of 0 indicates they share no properties;
A score of 1 indicates they share the same language component;
A score of 2 indicates they share the same language and country component;
A score of 3 indicates they share the same language, country, and variant components and are thus fully equivalent.
locale1 - the first Locale object to comparelocale2 - the second Locale object to compare
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||