Class DefaultResourceBundleFactory
- java.lang.Object
-
- org.pentaho.reporting.engine.classic.core.DefaultResourceBundleFactory
-
- All Implemented Interfaces:
Serializable
,ResourceBundleFactory
public class DefaultResourceBundleFactory extends Object implements ResourceBundleFactory
A default implementation of the ResourceBundleFactory, that creates resource bundles using the specified locale. If not defined otherwise, this implementation usesLocale.getDefault()
as Locale.- Author:
- Thomas Morgner
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface org.pentaho.reporting.engine.classic.core.ResourceBundleFactory
DEFAULT_RESOURCE_BUNDLE_CONFIG_KEY
-
-
Constructor Summary
Constructors Constructor Description DefaultResourceBundleFactory()
Creates a new DefaultResourceBundleFactory using the system's default locale as factory locale.DefaultResourceBundleFactory(Locale locale)
Creates a new DefaultResourceBundleFactory using the specified locale as factory locale.DefaultResourceBundleFactory(Locale locale, TimeZone timeZone)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Locale
getLocale()
Returns the locale that will be used to create the resource bundle.ResourceBundle
getResourceBundle(String key)
Creates a resource bundle named by the given key and using the factory's defined locale.TimeZone
getTimeZone()
void
setLocale(Locale locale)
Redefines the locale.
-
-
-
Constructor Detail
-
DefaultResourceBundleFactory
public DefaultResourceBundleFactory()
Creates a new DefaultResourceBundleFactory using the system's default locale as factory locale.
-
DefaultResourceBundleFactory
public DefaultResourceBundleFactory(Locale locale)
Creates a new DefaultResourceBundleFactory using the specified locale as factory locale.- Parameters:
locale
- the Locale instance that should be used when creating ResourceBundles.- Throws:
NullPointerException
- if the given Locale is null.
-
-
Method Detail
-
getTimeZone
public TimeZone getTimeZone()
- Specified by:
getTimeZone
in interfaceResourceBundleFactory
-
getLocale
public Locale getLocale()
Returns the locale that will be used to create the resource bundle.- Specified by:
getLocale
in interfaceResourceBundleFactory
- Returns:
- the locale.
-
setLocale
public void setLocale(Locale locale)
Redefines the locale. The locale given must not be null.- Parameters:
locale
- the new locale (never null).- Throws:
NullPointerException
- if the given locale is null.
-
getResourceBundle
public ResourceBundle getResourceBundle(String key)
Creates a resource bundle named by the given key and using the factory's defined locale.- Specified by:
getResourceBundle
in interfaceResourceBundleFactory
- Parameters:
key
- the name of the resourcebundle, never null.- Returns:
- the created resource bundle
- Throws:
NullPointerException
- ifkey
isnull
MissingResourceException
- if no resource bundle for the specified base name can be found- See Also:
ResourceBundle.getBundle(String, Locale)
-
-