|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.dna.impl.AbstractFreezable
org.codehaus.dna.impl.DefaultResourceLocator
ResourceLocator implementation backed by a Map and
optionally delegating to parent ResourceLocators.
The developer should create the DefaultResourceLocator,
associate resources with locator and then invoke
AbstractFreezable.makeReadOnly()
before passing the Locator to
the client component.
The implementation will first check for resources associated with itself and if unable to locate resource locally it will delegate to parent ResourceLocator.
Constructor Summary | |
DefaultResourceLocator()
Create a ResourceLocator with no parent. |
|
DefaultResourceLocator(ResourceLocator parent)
Create a ResourceLocator with specified parent. |
Method Summary | |
protected void |
checkWriteable()
Check if the resource has been "frozen" and thus is read only. |
boolean |
contains(java.lang.String key)
Return true if a resource exists with specified key. |
protected ResourceLocator |
getParent()
Return the parent ResourceLocator if any. |
protected java.util.Map |
getResourceMap()
Return the map used to store resources. |
protected boolean |
isReadOnly()
Return true if resource has been made read-only or frozen. |
java.lang.Object |
lookup(java.lang.String key)
Return resource registered with specified key. |
void |
makeReadOnly()
Mark the resource as read only. |
void |
put(java.lang.String key,
java.lang.Object resource)
Add a resource to resource locator. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DefaultResourceLocator()
public DefaultResourceLocator(ResourceLocator parent)
parent
- the parent ResourceLocatorMethod Detail |
public java.lang.Object lookup(java.lang.String key) throws MissingResourceException
lookup
in interface ResourceLocator
key
- the key
MissingResourceException
- if unable to locate
resource with specified keypublic boolean contains(java.lang.String key)
contains
in interface ResourceLocator
key
- the key
public void put(java.lang.String key, java.lang.Object resource)
key
- the key used to store resource (Must not be null).resource
- the resource (Must not be null).protected final ResourceLocator getParent()
protected final java.util.Map getResourceMap()
public void makeReadOnly()
makeReadOnly
in interface Freezable
protected final void checkWriteable()
java.lang.IllegalStateException
- if resource is read-onlyprotected final boolean isReadOnly()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |