Interface Setting<T>
- Type Parameters:
T- the data type for the value
- All Known Implementing Classes:
AbstractSetting,ListListSetting,ListSetting,MapListSetting,StringSetting
public interface Setting<T>
Interface for a preference value.
Implementations must provide a proper
equals method.- Since:
- 12881 (moved from package
org.openstreetmap.josm.data.preferences)
-
Method Summary
Modifier and TypeMethodDescriptioncopy()Clone the current object.default booleanCheck if the value of this Setting object is equal to the given value.Returns a setting whose value is null.getTime()Get the time for this setting.getValue()Returns the value of this setting.booleanisNew()Return if the setting has been marked as new.voidsetNew(boolean isNew) Mark setting as new.voidSet the time for this setting.voidvisit(SettingVisitor visitor) Enable usage of the visitor pattern.
-
Method Details
-
getValue
Returns the value of this setting.- Returns:
- the value of this setting
-
equalVal
Check if the value of this Setting object is equal to the given value.- Parameters:
otherVal- the other value- Returns:
- true if the values are equal
-
copy
Clone the current object.- Returns:
- an identical copy of the current object
-
visit
Enable usage of the visitor pattern.- Parameters:
visitor- the visitor
-
getNullInstance
Returns a setting whose value is null. Cannot be static, because there is no static inheritance.- Returns:
- a Setting object that isn't null itself, but returns null
for
getValue()
-
setTime
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.- Parameters:
time- the time in seconds since epoch
-
getTime
Get the time for this setting.- Returns:
- the time for this setting
- See Also:
-
setNew
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).- Parameters:
isNew- true, if it is new
-
isNew
boolean isNew()Return if the setting has been marked as new.- Returns:
- true, if the setting has been marked as new
- See Also:
-