Class AbstractSetting<T>
- java.lang.Object
-
- org.openstreetmap.josm.spi.preferences.AbstractSetting<T>
-
- Type Parameters:
T- The setting type
- All Implemented Interfaces:
Setting<T>
- Direct Known Subclasses:
ListListSetting,ListSetting,MapListSetting,StringSetting
public abstract class AbstractSetting<T> extends java.lang.Object implements Setting<T>
Base abstract class of all settings, holding the setting value.- Since:
- 12881 (moved from package
org.openstreetmap.josm.data.preferences)
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractSetting(T value)Constructs a newAbstractSettingwith the given value
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)java.lang.LonggetTime()Get the time for this setting.TgetValue()Returns the value of this setting.inthashCode()booleanisNew()Return if the setting has been marked as new.voidsetNew(boolean isNew)Mark setting as new.voidsetTime(java.lang.Long time)Set the time for this setting.java.lang.StringtoString()-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.openstreetmap.josm.spi.preferences.Setting
copy, equalVal, getNullInstance, visit
-
-
-
-
Constructor Detail
-
AbstractSetting
protected AbstractSetting(T value)
Constructs a newAbstractSettingwith the given value- Parameters:
value- The setting value
-
-
Method Detail
-
getValue
public T getValue()
Description copied from interface:SettingReturns the value of this setting.
-
setTime
public void setTime(java.lang.Long time)
Description copied from interface:SettingSet the time for this setting. For default preferences. They are saved in a cache file. Keeping the time allows to discard very old default settings.
-
getTime
public java.lang.Long getTime()
Description copied from interface:SettingGet the time for this setting.- Specified by:
getTimein interfaceSetting<T>- Returns:
- the time for this setting
- See Also:
Setting.setTime(java.lang.Long)
-
setNew
public void setNew(boolean isNew)
Description copied from interface:SettingMark setting as new. For default preferences. A setting is marked as new, if it has been seen in the current session. Methods likeIPreferences.get(java.lang.String, java.lang.String), can be called from different parts of the code with the same key. In this case, the supplied default value must match. However, this is only an error if the mismatching default value has been seen in the same session (and not loaded from cache).
-
isNew
public boolean isNew()
Description copied from interface:SettingReturn if the setting has been marked as new.- Specified by:
isNewin interfaceSetting<T>- Returns:
- true, if the setting has been marked as new
- See Also:
Setting.setNew(boolean)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
-