Class CachingProperty<T>
java.lang.Object
org.openstreetmap.josm.data.preferences.AbstractProperty<T>
org.openstreetmap.josm.data.preferences.CachingProperty<T>
- Type Parameters:
T- property type
- All Implemented Interfaces:
AbstractProperty.ValueChangeListener<T>
public class CachingProperty<T>
extends AbstractProperty<T>
implements AbstractProperty.ValueChangeListener<T>
This is a special wrapper of
AbstractProperty.
The current preference value is cached. The value is invalidated if the preference was changed.- Since:
- 10824
-
Nested Class Summary
Nested classes/interfaces inherited from class org.openstreetmap.josm.data.preferences.AbstractProperty
AbstractProperty.InvalidPreferenceValueException, AbstractProperty.ValueChangeEvent<T>, AbstractProperty.ValueChangeListener<T> -
Field Summary
FieldsFields inherited from class org.openstreetmap.josm.data.preferences.AbstractProperty
defaultValue, key, preferences -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionget()Replies the value of this property.booleanSets this property to the specified value.voidvalueChanged(AbstractProperty.ValueChangeEvent<? extends T> e) Method called when a property value has changed.Methods inherited from class org.openstreetmap.josm.data.preferences.AbstractProperty
addListener, addListenerImpl, addWeakListener, cached, equals, getDefaultValue, getKey, getPreferences, hashCode, isSet, remove, removeListener, removeListenerImpl, storeDefaultValue
-
Field Details
-
cache
-
cacheValid
-
toCache
-
-
Constructor Details
-
CachingProperty
CachingProperty(AbstractProperty<T> toCache) Create a new caching property.- Parameters:
toCache- The property to cache.
-
-
Method Details
-
get
Description copied from class:AbstractPropertyReplies the value of this property.- Specified by:
getin classAbstractProperty<T>- Returns:
- the value of this property
-
put
Description copied from class:AbstractPropertySets this property to the specified value.- Specified by:
putin classAbstractProperty<T>- Parameters:
value- The new value of this property- Returns:
- true if something has changed (i.e. value is different than before)
-
valueChanged
Description copied from interface:AbstractProperty.ValueChangeListenerMethod called when a property value has changed.- Specified by:
valueChangedin interfaceAbstractProperty.ValueChangeListener<T>- Parameters:
e- property change event
-