Framework Professional Edition Package


com.prosyst.util.propertiesfile
Class ResourceBundle

java.lang.Object
  extended by com.prosyst.util.propertiesfile.ResourceBundle

public class ResourceBundle
extends java.lang.Object


Field Summary
protected  java.util.Hashtable resources
           
 
Constructor Summary
protected ResourceBundle(java.lang.String name, java.util.Hashtable resources)
          Constructs a new Resource bundle with Hashtable that stores localized resources.
 
Method Summary
static ResourceBundle getBundle(java.lang.String name, java.lang.String locale, Bundle loader)
          Obtains instance of ResourceBundle identified by it's name, locale and loaded using bundle to load the file.
static ResourceBundle getBundle(java.lang.String name, java.lang.String locale, Bundle loader, PackageAdmin pkgAdmin)
          This method is used to localize bundle manifest only.
 java.lang.String getLocale()
          This method is used to retrieve the locale that is used when loading the bundle.
static java.lang.String[] getLocales(java.lang.String name, Bundle loader)
           
 java.lang.Object getObject(java.lang.String key)
          Returns a localized object
static void removeFromCache(Bundle loader)
           
static void removeFromCache(java.lang.String name, java.lang.String locale, Bundle loader)
           
protected  void setLocale(java.lang.String locale)
          Sets the locale of the bundle
protected  void setParent(ResourceBundle parent)
          Sets the parent ResourceBundle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

resources

protected java.util.Hashtable resources
Constructor Detail

ResourceBundle

protected ResourceBundle(java.lang.String name,
                         java.util.Hashtable resources)
Constructs a new Resource bundle with Hashtable that stores localized resources.

Parameters:
name - the name of the properties file
resources - localized resources
Method Detail

getLocale

public java.lang.String getLocale()
This method is used to retrieve the locale that is used when loading the bundle.

Returns:
locale of the resource bundle

getObject

public java.lang.Object getObject(java.lang.String key)
                           throws java.util.MissingResourceException
Returns a localized object

Parameters:
key - the key of the object
Returns:
a localized object. This can be any Object, not particularly String.
Throws:
java.util.MissingResourceException - if there is no such key.

setLocale

protected void setLocale(java.lang.String locale)
Sets the locale of the bundle

Parameters:
locale - the locale

setParent

protected void setParent(ResourceBundle parent)
Sets the parent ResourceBundle

Parameters:
parent - a resource bundle

getBundle

public static ResourceBundle getBundle(java.lang.String name,
                                       java.lang.String locale,
                                       Bundle loader)
Obtains instance of ResourceBundle identified by it's name, locale and loaded using bundle to load the file.

The resource bundle will first check if name is class name. If there is such class it is instantiated and returned as result. That class *must* extend this ResourceBundle. If no class resource bundle is found it will look for an property file and load it. The properties specified in this file are used as i18n resources. This kind of resource bundles always return String object by their getObject() method. The Bundle-Classpath is used to search the property file. The methd Bundle.getResource() is used.

Parameters:
name - the name of resource bundle
locale - desired locale
loader - the bundle, that is used to read the properties from
Returns:
a resource bundle instance

getBundle

public static ResourceBundle getBundle(java.lang.String name,
                                       java.lang.String locale,
                                       Bundle loader,
                                       PackageAdmin pkgAdmin)
This method is used to localize bundle manifest only. The Bundle-Classpath is not used to search the property file.


getLocales

public static java.lang.String[] getLocales(java.lang.String name,
                                            Bundle loader)

removeFromCache

public static void removeFromCache(java.lang.String name,
                                   java.lang.String locale,
                                   Bundle loader)

removeFromCache

public static void removeFromCache(Bundle loader)

Framework Professional Edition Package


Copyright © 1999-2007 ProSyst Software GmbH. All Rights Reserved