Package org.jgrapes.webconsole.base
Class ConsoleResourceBundleControl
java.lang.Object
java.util.ResourceBundle.Control
org.jgrapes.webconsole.base.ConsoleResourceBundleControl
A
ResourceBundle.Control
that implements a special lookup
algorithm.See newBundle(java.lang.String, java.util.Locale, java.lang.String, java.lang.ClassLoader, boolean)
.
-
Field Summary
Fields inherited from class java.util.ResourceBundle.Control
FORMAT_CLASS, FORMAT_DEFAULT, FORMAT_PROPERTIES, TTL_DONT_CACHE, TTL_NO_EXPIRATION_CONTROL
-
Constructor Summary
ConstructorDescriptionConsoleResourceBundleControl
(List<Class<?>> clses) Instantiates a new web console resource bundle control. -
Method Summary
Modifier and TypeMethodDescriptiongetFallbackLocale
(String baseName, Locale locale) Returnsnull
(no fallback).getFormats
(String baseName) newBundle
(String baseName, Locale locale, String format, ClassLoader loader, boolean reload) Creates a new resource bundle using the classes passed to the constructor and the base name.Methods inherited from class java.util.ResourceBundle.Control
getCandidateLocales, getControl, getNoFallbackControl, getTimeToLive, needsReload, toBundleName, toResourceName
-
Constructor Details
-
ConsoleResourceBundleControl
Instantiates a new web console resource bundle control.- Parameters:
clses
- the classes to use
-
-
Method Details
-
getFormats
- Overrides:
getFormats
in classResourceBundle.Control
-
getFallbackLocale
Returnsnull
(no fallback).- Overrides:
getFallbackLocale
in classResourceBundle.Control
-
newBundle
public ResourceBundle newBundle(String baseName, Locale locale, String format, ClassLoader loader, boolean reload) throws IllegalAccessException, InstantiationException, IOException Creates a new resource bundle using the classes passed to the constructor and the base name.For each class (in reverse order) an attempt is made to load a properties file relative to the class. If found, the entries are merged with any already existing entries. The class list usually consists of the web console class and its ancestor classes. Using this controller, derived classes can thus override resources from their base classes.
- Overrides:
newBundle
in classResourceBundle.Control
- Throws:
IllegalAccessException
InstantiationException
IOException
-