jChatBox.Util
Class XMLPropertyResourceBundle

java.lang.Object
  |
  +--jChatBox.Util.XMLPropertyResourceBundle

public class XMLPropertyResourceBundle
extends java.lang.Object

XMLPropertyResourceBundle implementation allowing to load resources properties from an XML file.


Constructor Summary
XMLPropertyResourceBundle()
          Dummy constructor.
XMLPropertyResourceBundle(java.io.InputStream in)
          Construct a XMLPropertyResourceBundle from an InputStream.
XMLPropertyResourceBundle(java.io.InputStream in, java.util.Locale locale)
          Construct a XMLPropertyResourceBundle from an InputStream and associate it to a Locale.
 
Method Summary
static XMLPropertyResourceBundle getBundle(java.lang.String bundle)
          Factory to get a XMLPropertyResourceBundle from a bundle.
static XMLPropertyResourceBundle getBundle(java.lang.String bundle, java.util.Locale locale)
          Factory to get a XMLPropertyResourceBundle from a bundle and a Locale.
static XMLPropertyResourceBundle getBundle(java.lang.String bundle, java.util.Locale locale, java.lang.ClassLoader classloader)
          Factory to get the appropriate XMLPropertyResourceBundle given a Locale and a ClassLoader.
 java.util.Iterator getKeys()
          Get an iterator for keys.
 java.lang.Object[] getKeysAsArray()
          Get an array of keys.
 java.util.Locale getLocale()
          Get Locale.
 java.lang.Object getObject(java.lang.String key)
          Get Object matching to key.
 java.lang.String getString(java.lang.String key)
          Get String matching to key.
 java.lang.Object handleGetObject(java.lang.String key)
          Get an object given a key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLPropertyResourceBundle

public XMLPropertyResourceBundle(java.io.InputStream in,
                                 java.util.Locale locale)
                          throws java.lang.Exception
Construct a XMLPropertyResourceBundle from an InputStream and associate it to a Locale.

Parameters:
in -
locale -

XMLPropertyResourceBundle

public XMLPropertyResourceBundle(java.io.InputStream in)
                          throws java.lang.Exception
Construct a XMLPropertyResourceBundle from an InputStream.

Parameters:
in -

XMLPropertyResourceBundle

public XMLPropertyResourceBundle()
Dummy constructor.

Method Detail

getBundle

public static XMLPropertyResourceBundle getBundle(java.lang.String bundle)
                                           throws java.util.MissingResourceException
Factory to get a XMLPropertyResourceBundle from a bundle.

Parameters:
bundle - bundlename
Returns:
XMLPropertyResourceBundle
Throws:
java.util.MissingResourceException

getBundle

public static XMLPropertyResourceBundle getBundle(java.lang.String bundle,
                                                  java.util.Locale locale)
                                           throws java.util.MissingResourceException
Factory to get a XMLPropertyResourceBundle from a bundle and a Locale.

Parameters:
bundle -
locale -
Returns:
Throws:
java.util.MissingResourceException

getBundle

public static XMLPropertyResourceBundle getBundle(java.lang.String bundle,
                                                  java.util.Locale locale,
                                                  java.lang.ClassLoader classloader)
                                           throws java.util.MissingResourceException

Factory to get the appropriate XMLPropertyResourceBundle given a Locale and a ClassLoader.

Searches for bundle through classloader by checking:

bundlename + "_" + language + "_" + country + "_" + variant + ".xml"
bundlename + "_" + language + "_" + country + ".xml"
bundlename + "_" + language + ".xml"

bundlename + ".xml"

If the language is EN and the country is US and the bundlename is resource, it will search for :

1. resource_en_US.xml
2. resource_en.xml
3. resource.xml

Parameters:
bundle -
locale -
classloader -
Returns:
Throws:
java.util.MissingResourceException

getLocale

public java.util.Locale getLocale()
Get Locale.

Returns:

getObject

public java.lang.Object getObject(java.lang.String key)
                           throws java.util.MissingResourceException
Get Object matching to key.

Parameters:
key -
Returns:
Throws:
java.util.MissingResourceException

getString

public java.lang.String getString(java.lang.String key)
                           throws java.util.MissingResourceException
Get String matching to key.

Parameters:
key -
Returns:
Throws:
java.util.MissingResourceException

getKeys

public java.util.Iterator getKeys()
Get an iterator for keys.

Returns:

getKeysAsArray

public java.lang.Object[] getKeysAsArray()
Get an array of keys.

Returns:

handleGetObject

public java.lang.Object handleGetObject(java.lang.String key)
Get an object given a key.

Parameters:
key -
Returns: