|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.ontopia.utils.CachedStringifier<T>
public class CachedStringifier<T>
INTERNAL: Stringifier that maintains a cache of previously stringified objects. It works with any implementation of StringifierIF.
The cache is first checked to see if a stringified version already exists. Otherwise the object is stringified and the cache is updated.
Field Summary | |
---|---|
protected Map<T,String> |
cache
|
protected StringifierIF<? super T> |
stringifier
|
Constructor Summary | |
---|---|
CachedStringifier(StringifierIF<? super T> stringifier)
|
Method Summary | |
---|---|
StringifierIF<? super T> |
getStringifier()
Gets the stringifier that is to be cached. |
void |
refresh()
Refreshes the cache. |
void |
setStringifier(StringifierIF<? super T> stringifier)
Sets the stringifier that is to be cached. |
String |
toString(T object)
Returns a stringified version of the object, i.e. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected StringifierIF<? super T> stringifier
protected Map<T,String> cache
Constructor Detail |
---|
public CachedStringifier(StringifierIF<? super T> stringifier)
Method Detail |
---|
public StringifierIF<? super T> getStringifier()
public void setStringifier(StringifierIF<? super T> stringifier)
public String toString(T object)
StringifierIF
toString
in interface StringifierIF<T>
object
- the object that is to be made a string
representation of.
object
argument.public void refresh()
CachedIF
refresh
in interface CachedIF
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |