org.jfree.report
Class DefaultResourceBundleFactory

java.lang.Object
  |
  +--org.jfree.report.DefaultResourceBundleFactory

public class DefaultResourceBundleFactory
extends java.lang.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

Fields inherited from interface org.jfree.report.ResourceBundleFactory
DEFAULT_RESOURCE_BUNDLE_CONFIG_KEY
 
Constructor Summary
DefaultResourceBundleFactory()
          Creates a new DefaultResourceBundleFactory using the system's default locale as factory locale.
DefaultResourceBundleFactory(java.util.Locale locale)
          Creates a new DefaultResourceBundleFactory using the specified locale as factory locale.
 
Method Summary
 java.util.Locale getLocale()
          Returns the locale that will be used to create the resource bundle.
 java.util.ResourceBundle getResourceBundle(java.lang.String key)
          Creates a resource bundle named by the given key and using the factory's defined locale.
 void setLocale(java.util.Locale locale)
          Redefines the locale.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, 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(java.util.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:
java.lang.NullPointerException - if the given Locale is null.
Method Detail

getLocale

public java.util.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(java.util.Locale locale)
Redefines the locale. The locale given must not be null.
Parameters:
locale - the new locale (never null).
Throws:
java.lang.NullPointerException - if the given locale is null.

getResourceBundle

public java.util.ResourceBundle getResourceBundle(java.lang.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:
java.lang.NullPointerException - if key is null
java.util.MissingResourceException - if no resource bundle for the specified base name can be found
See Also:
ResourceBundle.getBundle(String,Locale)