Package net.sf.basedb.util.resources
Class ResourceBundleFactory
- java.lang.Object
-
- net.sf.basedb.util.resources.ResourceBundleFactory
-
public class ResourceBundleFactory extends Object
Factory for loading resource bundles. The factory returnResourceBundleWrapper
objects which are wrappers around regularResourceBundle
:s that provide us with some extra functionality.NOTE! Plug-ins and extensions that are not part of the BASE core are usually loaded with a different class loader than the rest of BASE. If they are including resource in their own JAR files, they must use the versions that take a class loader as the last parameter and set it to the class loader of of their own classes. Eg.
this.getClass().getClassLoader()
.- Since:
- 2.16
- Author:
- Nicklas
- Last modified
- $Date: 2010-09-16 13:32:06 +0200 (to, 16 sep 2010) $
-
-
Constructor Summary
Constructors Modifier Constructor Description private
ResourceBundleFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ResourceBundleWrapper
getResourceBundle(String name, Locale locale)
Same asgetResouceBundle(name, locale, null)
.static ResourceBundleWrapper
getResourceBundle(String name, Locale locale, ClassLoader loader)
Get a resource bundle for the given locale.static ResourceBundleWrapper
getResourceBundle(String name, SessionControl sc)
Same asgetResouceBundle(name, sc, null)
.static ResourceBundleWrapper
getResourceBundle(String name, SessionControl sc, ClassLoader loader)
Get a resource bundle for the given session control.
-
-
-
Method Detail
-
getResourceBundle
public static ResourceBundleWrapper getResourceBundle(String name, SessionControl sc)
Same asgetResouceBundle(name, sc, null)
.
-
getResourceBundle
public static ResourceBundleWrapper getResourceBundle(String name, SessionControl sc, ClassLoader loader)
Get a resource bundle for the given session control. If the session control is not null theSessionControl.getLocale()
is used as the locale, otherwise the server default locale (Config.getLocale()
) is used.- Parameters:
name
- The name of the resource bundlesc
- A session control, or nullloader
- The class loader to use when locating the resource bundle(s). If null, the context class loader of the current thread is used- Returns:
- A resource bundle wrapper
- See Also:
Thread.getContextClassLoader()
-
getResourceBundle
public static ResourceBundleWrapper getResourceBundle(String name, Locale locale)
Same asgetResouceBundle(name, locale, null)
.
-
getResourceBundle
public static ResourceBundleWrapper getResourceBundle(String name, Locale locale, ClassLoader loader)
Get a resource bundle for the given locale.- Parameters:
name
- The name of the resource bundlelocale
- A locale objectloader
- The class loader to use when locating the resource bundle(s). If null, the context class loader of the current thread is used- Returns:
- A resource bundle wrapper
- See Also:
Thread.getContextClassLoader()
-
-