org.pentaho.reporting.engine.classic.core
Class DefaultResourceBundleFactory

java.lang.Object
  extended by 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 uses Locale.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
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
 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.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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.

DefaultResourceBundleFactory

public DefaultResourceBundleFactory(Locale locale,
                                    TimeZone timeZone)
Method Detail

getTimeZone

public TimeZone getTimeZone()
Specified by:
getTimeZone in interface ResourceBundleFactory

getLocale

public Locale getLocale()
Returns the locale that will be used to create the resource bundle.

Specified by:
getLocale in interface ResourceBundleFactory
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 interface ResourceBundleFactory
Parameters:
key - the name of the resourcebundle, never null.
Returns:
the created resource bundle
Throws:
NullPointerException - if key is null
MissingResourceException - if no resource bundle for the specified base name can be found
See Also:
ResourceBundle.getBundle(String,Locale)