T - property typepublic class CachingProperty<T> extends AbstractProperty<T> implements AbstractProperty.ValueChangeListener<T>
AbstractProperty.
The current preference value is cached. The value is invalidated if the preference was changed.AbstractProperty.InvalidPreferenceValueException, AbstractProperty.ValueChangeEvent<T>, AbstractProperty.ValueChangeListener<T>| Modifier and Type | Field and Description |
|---|---|
private T |
cache |
private boolean |
cacheValid |
private AbstractProperty<T> |
toCache |
defaultValue, key, preferences| Constructor and Description |
|---|
CachingProperty(AbstractProperty<T> toCache)
Create a new caching property.
|
| Modifier and Type | Method and Description |
|---|---|
T |
get()
Replies the value of this property.
|
boolean |
put(T value)
Sets this property to the specified value.
|
void |
valueChanged(AbstractProperty.ValueChangeEvent<? extends T> e)
Method called when a property value has changed.
|
addListener, addListenerImpl, addWeakListener, cached, equals, getDefaultValue, getKey, getPreferences, hashCode, isSet, remove, removeListener, removeListenerImpl, storeDefaultValueprivate boolean cacheValid
private final AbstractProperty<T> toCache
CachingProperty(AbstractProperty<T> toCache)
toCache - The property to cache.public T get()
AbstractPropertyget in class AbstractProperty<T>public boolean put(T value)
AbstractPropertyput in class AbstractProperty<T>value - The new value of this propertypublic void valueChanged(AbstractProperty.ValueChangeEvent<? extends T> e)
AbstractProperty.ValueChangeListenervalueChanged in interface AbstractProperty.ValueChangeListener<T>e - property change event