net.sf.jguiraffe.resources.impl.bundle
Class BundleResourceGroup

java.lang.Object
  extended by net.sf.jguiraffe.resources.impl.bundle.BundleResourceGroup
All Implemented Interfaces:
ResourceGroup

 class BundleResourceGroup
extends java.lang.Object
implements ResourceGroup

A specialized implementation of the ResourceGroup interface that is backed by a java.util.ResourceBundle.

The methods required by the ResourceGroup interface are delegated to the internally managed resource bunde. During construction this bundle is loaded for the specified base name and locale.

Version:
$Id: BundleResourceGroup.java 4 2006-03-23 20:49:54Z oheger $
Author:
Oliver Heger

Constructor Summary
BundleResourceGroup(java.lang.String name, java.util.Locale locale)
          Creates a new instance of BundleResourceGroup and initializes it.
 
Method Summary
 java.util.ResourceBundle getBundle()
          Returns the bundle that is wrapped by this resource group.
 java.util.Set getKeys()
          Returns a set with all keys contained in this resource group.
 java.util.Locale getLocale()
          Returns the locale of this group.
 java.lang.Object getName()
          Returns the name of this resource group.
 java.lang.Object getResource(java.lang.Object key)
          Returns the resource for the specified key.
protected  java.util.ResourceBundle initBundle(java.lang.String name, java.util.Locale locale)
          Initializes the specified resource bundle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BundleResourceGroup

public BundleResourceGroup(java.lang.String name,
                           java.util.Locale locale)
                    throws java.util.MissingResourceException
Creates a new instance of BundleResourceGroup and initializes it.

Parameters:
name - the group's name
locale - the locale
Throws:
java.util.MissingResourceException - if the bundle cannot be found
Method Detail

getBundle

public java.util.ResourceBundle getBundle()
Returns the bundle that is wrapped by this resource group.

Returns:
the underlying bundle

getName

public java.lang.Object getName()
Returns the name of this resource group.

Specified by:
getName in interface ResourceGroup
Returns:
the name of this group

getKeys

public java.util.Set getKeys()
Returns a set with all keys contained in this resource group.

Specified by:
getKeys in interface ResourceGroup
Returns:
a set with the defined keys

getLocale

public java.util.Locale getLocale()
Returns the locale of this group.

Specified by:
getLocale in interface ResourceGroup
Returns:
the locale

getResource

public java.lang.Object getResource(java.lang.Object key)
                             throws java.util.MissingResourceException
Returns the resource for the specified key.

Specified by:
getResource in interface ResourceGroup
Parameters:
key - the key
Returns:
the resource for this key
Throws:
java.util.MissingResourceException - if this key is unknown

initBundle

protected java.util.ResourceBundle initBundle(java.lang.String name,
                                              java.util.Locale locale)
                                       throws java.util.MissingResourceException
Initializes the specified resource bundle.

Parameters:
name - the bundle's base name
locale - the locale
Returns:
the bundle instance
Throws:
java.util.MissingResourceException - if the bundle cannot be found


Copyright 2007 null. All Rights Reserved.