|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.ResourceBundle
com.taco.util.AccessibleResourceBundle
com.taco.util.CachedKeysResourceBundle
public abstract class CachedKeysResourceBundle
A subclass of AccessibleResourceBundle
that provides a
useful implementation of getKeys()
.
Field Summary | |
---|---|
protected java.util.Set |
_cachedKeySet
If _useSoftCache is false, this field maintains a strong
reference to the key set computed the first time getKeys()
is called. |
protected java.lang.ref.SoftReference |
_keySetRef
If _useSoftCache is false, this field is soft reference to
the key set computed the first time getKeys() is called. |
protected boolean |
_useSoftCache
A flag indicating whether a soft reference to the key set should be maintained in _keySetRef . |
Fields inherited from class com.taco.util.AccessibleResourceBundle |
---|
_isParentSet, _locale |
Fields inherited from class java.util.ResourceBundle |
---|
parent |
Constructor Summary | |
---|---|
CachedKeysResourceBundle()
Create a new instance that uses a soft reference to store the previously computed set of keys, so the key set can be garbage collected if necessary. |
|
CachedKeysResourceBundle(boolean useSoftCache)
Create a new instance that uses a cache to store the previously computed set of keys. |
Method Summary | |
---|---|
protected abstract java.util.Iterator |
_getProperKeys()
Return an iteration over the keys defined by this bundle only, not by its parents. |
java.util.Enumeration |
getKeys()
If the key set has not been cached, compute the key set by first adding all of the parent's keys to the key set, then adding all this bundle's keys (returned by _getProperKeys() ). |
boolean |
getUseSoftCache()
Return true if this instance uses a soft reference to cache the key set. |
void |
invalidateCache()
Invalidate the cache of the key set. |
void |
setUseSoftCache(boolean useSoftCache)
Switch the caching mode. |
Methods inherited from class com.taco.util.AccessibleResourceBundle |
---|
getLocale, getParent, setLocale, setParent |
Methods inherited from class java.util.ResourceBundle |
---|
getBundle, getBundle, getBundle, getObject, getString, getStringArray, handleGetObject |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected boolean _useSoftCache
_keySetRef
. Otherwise, a strong reference
is maintained in _cachedKeySet
.
protected java.lang.ref.SoftReference _keySetRef
_useSoftCache
is false, this field is soft reference to
the key set computed the first time getKeys()
is called.
If null
, the key set hasn't been computed yet.
protected java.util.Set _cachedKeySet
_useSoftCache
is false, this field maintains a strong
reference to the key set computed the first time getKeys()
is called. If null
, the key set hasn't been computed yet.
Constructor Detail |
---|
public CachedKeysResourceBundle()
public CachedKeysResourceBundle(boolean useSoftCache)
useSoftCache
is
true
, the cache is implemented as a soft reference so the
key set can be garbage collected if necessary.
Method Detail |
---|
public java.util.Enumeration getKeys()
_getProperKeys()
). Return an
Enumeration
over the key set's elements.
getKeys
in class java.util.ResourceBundle
public void invalidateCache()
public boolean getUseSoftCache()
public void setUseSoftCache(boolean useSoftCache)
protected abstract java.util.Iterator _getProperKeys()
getKeys()
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |