public interface ResourceManager
Definition of an interface for accessing resources in a generic way.
Through this interface applications can access a resource manager object that
is able to provide access to resource items or whole resource groups. This
service is completely independent on the way the resources of this
application are stored. The physical resource access is performed by a
ResourceLoader
object that is associated with this class.
Resources supported by this library are always organized in logical resource groups. This allows for a logic structure. When resources are accessed a group name must always be provided.
This interface defines all needed methods for accessing resources. A single item can be retrieved as object or, for convenience purpose, as string. It is also possible to retrieve a whole resource group.
ResourceGroup
,
ResourceLoader
Modifier and Type | Method and Description |
---|---|
Object |
getDefaultResourceGroup()
Returns the name of the default resource group.
|
Object |
getResource(Locale locale,
Object group,
Object key)
Returns the resource for the given
Locale , resource
group, and key. |
ResourceGroup |
getResourceGroup(Locale locale,
Object group)
Returns the resource group for the specified
Locale with
the given name. |
ResourceLoader |
getResourceLoader()
Returns the
ResourceLoader that is associated with this
resource manager. |
String |
getText(Locale locale,
Object group,
Object key)
Returns the text resource for the given combination of a
Locale , resource group, and resource key. |
void |
setDefaultResourceGroup(Object grp)
Sets the name of the default resource group.
|
void |
setResourceLoader(ResourceLoader resourceLoader)
Sets the
ResourceLoader for this resource manager. |
Object getResource(Locale locale, Object group, Object key) throws MissingResourceException
Locale
, resource
group, and key.locale
- the Locale
group
- the name of the resource group the resource belongs tokey
- the resource keyMissingResourceException
- if the resource cannot be foundString getText(Locale locale, Object group, Object key) throws MissingResourceException
Locale
, resource group, and resource key. This is a
convenience method if the resource is known to be a text resource.locale
- the Locale
group
- the name of the resource group the resource belongs tokey
- the resource keyMissingResourceException
- if the resource cannot be foundResourceLoader getResourceLoader()
ResourceLoader
that is associated with this
resource manager.ResourceLoader
void setResourceLoader(ResourceLoader resourceLoader)
ResourceLoader
for this resource manager. This
loader is then used to retrieve resource groups.resourceLoader
- the ResourceLoader
to be usedResourceGroup getResourceGroup(Locale locale, Object group) throws MissingResourceException
Locale
with
the given name. The returned object can be used to retrieve all resources
that belong to this group at once.locale
- the Locale
group
- the name of the resource groupMissingResourceException
- if the resource group cannot be foundObject getDefaultResourceGroup()
void setDefaultResourceGroup(Object grp)
grp
- the name of the default resource groupCopyright © 2016 The JGUIraffe Team. All rights reserved.