public class ResourceManagerImpl extends Object implements ResourceManager
A default implementation of the ResourceManager
interface.
This class provides a fully functional ResourceManager
implementation that can be used as is. There is usually no need to subclass
this class or use a different implementation.
The class uses the associated ResourceLoader
to retrieve
requested resources or resource groups. No caching is performed, this can be
done in the ResourceLoader
.
Implementation note: This class is thread-safe.
Constructor and Description |
---|
ResourceManagerImpl()
Creates a new instance of
ResourceManagerImpl . |
ResourceManagerImpl(ResourceLoader loader)
Creates a new instance of
ResourceManagerImpl and
initializes the associated resource loader. |
Modifier and Type | Method and Description |
---|---|
protected ResourceLoader |
fetchLoader()
Fetches the resource loader.
|
Object |
getDefaultResourceGroup()
Returns the name of the default resource group.
|
Object |
getResource(Locale locale,
Object group,
Object key)
Returns the specified resource.
|
ResourceGroup |
getResourceGroup(Locale locale,
Object group)
Returns the specified resource group.
|
ResourceLoader |
getResourceLoader()
Returns the associated
ResourceLoader object. |
String |
getText(Locale locale,
Object group,
Object key)
Returns the text of the specified resource.
|
void |
setDefaultResourceGroup(Object grp)
Sets the name of the default resource group.
|
void |
setResourceLoader(ResourceLoader resourceLoader)
Sets the
ResourceLoader to use. |
public ResourceManagerImpl()
ResourceManagerImpl
.public ResourceManagerImpl(ResourceLoader loader)
ResourceManagerImpl
and
initializes the associated resource loader.loader
- the resource loader to usepublic Object getResource(Locale locale, Object group, Object key)
getResource
in interface ResourceManager
locale
- the Locale
group
- the owning resource group's namekey
- the resource keyMissingResourceException
- if the resource cannot be foundpublic ResourceGroup getResourceGroup(Locale locale, Object group)
getResourceGroup
in interface ResourceManager
locale
- the Locale
of the groupgroup
- the group's nameMissingResourceException
- if the group cannot be foundpublic String getText(Locale locale, Object group, Object key) throws MissingResourceException
getText
in interface ResourceManager
locale
- the Locale
group
- the name of the resource groupkey
- the resource keyMissingResourceException
- if the resource cannot be foundpublic ResourceLoader getResourceLoader()
ResourceLoader
object.getResourceLoader
in interface ResourceManager
ResourceLoader
public void setResourceLoader(ResourceLoader resourceLoader)
ResourceLoader
to use. Requests for resource
groups are delegated to this object.setResourceLoader
in interface ResourceManager
resourceLoader
- the ResourceLoader
to useprotected ResourceLoader fetchLoader()
public Object getDefaultResourceGroup()
getDefaultResourceGroup
in interface ResourceManager
public void setDefaultResourceGroup(Object grp)
setDefaultResourceGroup
in interface ResourceManager
grp
- the name of the default resource groupCopyright © 2016 The JGUIraffe Team. All rights reserved.