Class CachedProperty<T>
- java.lang.Object
-
- org.openstreetmap.josm.data.preferences.AbstractProperty<T>
-
- org.openstreetmap.josm.data.preferences.CachedProperty<T>
-
- Type Parameters:
T- The value type of this property
- All Implemented Interfaces:
PreferenceChangedListener
public abstract class CachedProperty<T> extends AbstractProperty<T> implements PreferenceChangedListener
This is an old-style cached preference value. You can replace this using theAbstractProperty.cached(),AbstractProperty.cached()accessors
-
-
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
Fields Modifier and Type Field Description private java.lang.StringdefaultValueAsStringprivate intupdateCountprivate Tvalue-
Fields inherited from class org.openstreetmap.josm.data.preferences.AbstractProperty
defaultValue, key, preferences
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedCachedProperty(java.lang.String key, java.lang.String defaultValueAsString)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract TfromString(java.lang.String s)Tget()Replies the value of this property.java.lang.StringgetAsString()TgetDefaultValue()Replies the default value of this property.java.lang.StringgetDefaultValueAsString()intgetUpdateCount()voidpreferenceChanged(PreferenceChangeEvent e)Triggered when a preference entry value changes.voidput(java.lang.String value)booleanput(T value)Sets this property to the specified value.protected voidupdateValue()-
Methods inherited from class org.openstreetmap.josm.data.preferences.AbstractProperty
addListener, addListenerImpl, addWeakListener, cached, equals, getKey, getPreferences, hashCode, isSet, remove, removeListener, removeListenerImpl, storeDefaultValue
-
-
-
-
Field Detail
-
defaultValueAsString
private final java.lang.String defaultValueAsString
-
updateCount
private int updateCount
-
-
Constructor Detail
-
CachedProperty
protected CachedProperty(java.lang.String key, java.lang.String defaultValueAsString)
-
-
Method Detail
-
updateValue
protected final void updateValue()
-
fromString
protected abstract T fromString(java.lang.String s)
-
get
public T get()
Description copied from class:AbstractPropertyReplies the value of this property.- Specified by:
getin classAbstractProperty<T>- Returns:
- the value of this property
-
put
public void put(java.lang.String value)
-
put
public final boolean put(T value)
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)
-
getUpdateCount
public int getUpdateCount()
-
getDefaultValue
public T getDefaultValue()
Description copied from class:AbstractPropertyReplies the default value of this property.- Overrides:
getDefaultValuein classAbstractProperty<T>- Returns:
- The default value of this property
-
getDefaultValueAsString
public java.lang.String getDefaultValueAsString()
-
getAsString
public java.lang.String getAsString()
-
preferenceChanged
public void preferenceChanged(PreferenceChangeEvent e)
Description copied from interface:PreferenceChangedListenerTriggered when a preference entry value changes.- Specified by:
preferenceChangedin interfacePreferenceChangedListener- Parameters:
e- the preference change event
-
-