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 protected
AbstractSetting(T value)
Constructs a newAbstractSetting
with the given value
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
java.lang.Long
getTime()
Get the time for this setting.T
getValue()
Returns the value of this setting.int
hashCode()
boolean
isNew()
Return if the setting has been marked as new.void
setNew(boolean isNew)
Mark setting as new.void
setTime(java.lang.Long time)
Set the time for this setting.java.lang.String
toString()
-
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 newAbstractSetting
with the given value- Parameters:
value
- The setting value
-
-
Method Detail
-
getValue
public T getValue()
Description copied from interface:Setting
Returns the value of this setting.
-
setTime
public void setTime(java.lang.Long time)
Description copied from interface:Setting
Set 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:Setting
Get the time for this setting.- Specified by:
getTime
in 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:Setting
Mark 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:Setting
Return if the setting has been marked as new.- Specified by:
isNew
in interfaceSetting<T>
- Returns:
- true, if the setting has been marked as new
- See Also:
Setting.setNew(boolean)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
-