org.iscreen.impl
Class ConfiguredResource

java.lang.Object
  extended by org.iscreen.impl.ConfiguredResource
All Implemented Interfaces:
Resource

public class ConfiguredResource
extends java.lang.Object
implements Resource

Represents a Resource that includes its configuration. The Resource handles resource bundle names and is able to load them dynamically for different locales. In addition, it can have a "parent" reference to another ConfiguredResource so that instances can be chained together. When an instance refers to another "parent" resource, it overrides any resources defined in the reference resource.

Author:
Shellman, Dan

Constructor Summary
ConfiguredResource()
          Default constructor.
 
Method Summary
 void addMessage(java.lang.String key, java.lang.String value)
          Adds an individual message as a resource, available via its key.
 void addResourceFile(java.lang.String location)
          Adds a resource bundle based upon its classpath location.
 void addResourceFiles(java.util.Set fileSet)
          Adds a Set of resource bundle locations (Set of String objects).
 java.lang.String getValue(java.lang.String key, java.util.Locale locale)
          Gets the value of the message key.
 void setId(java.lang.String theId)
          Sets the id of the resource.
 void setRef(ConfiguredResource resource)
          Sets a reference to another ConfiguredResource.
 java.lang.String toString()
          For debug info.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConfiguredResource

public ConfiguredResource()
Default constructor.

Method Detail

addMessage

public void addMessage(java.lang.String key,
                       java.lang.String value)
Adds an individual message as a resource, available via its key.

Parameters:
key - The key to the message resource
value - The value of the message

addResourceFile

public void addResourceFile(java.lang.String location)
Adds a resource bundle based upon its classpath location.

Parameters:
location - The classpath location of the resource bundle.

addResourceFiles

public void addResourceFiles(java.util.Set fileSet)
Adds a Set of resource bundle locations (Set of String objects).

Parameters:
fileSet - A Set of Strings representing resource bundles.

setRef

public void setRef(ConfiguredResource resource)
Sets a reference to another ConfiguredResource. If a key value isn't found in this resource, the referenced one will be checked.

Parameters:
resource - The "parent" resource.

setId

public void setId(java.lang.String theId)
Sets the id of the resource.

Parameters:
theId - The id of the resource.

getValue

public java.lang.String getValue(java.lang.String key,
                                 java.util.Locale locale)
Gets the value of the message key.

Specified by:
getValue in interface Resource
Parameters:
key - The message key
locale - The locale to use in retrieving the value.
Returns:
Returns the value of the message key.

toString

public java.lang.String toString()
For debug info.

Overrides:
toString in class java.lang.Object
Returns:
Returns debug info.