Class FallbackProperty<T>
java.lang.Object
org.openstreetmap.josm.data.preferences.AbstractProperty<T>
org.openstreetmap.josm.data.preferences.FallbackProperty<T>
- Type Parameters:
T- The content type
Property that wraps another property along with a fallback property that is used as default value.
- Since:
- 12987
-
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
FieldsModifier and TypeFieldDescriptionprivate final AbstractProperty<T>private final AbstractProperty<T>Fields inherited from class org.openstreetmap.josm.data.preferences.AbstractProperty
defaultValue, key, preferences -
Constructor Summary
ConstructorsConstructorDescriptionFallbackProperty(AbstractProperty<T> property, AbstractProperty<T> fallback) Constructs a newFallbackProperty. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddListenerImpl(PreferenceChangedListener adapter) voidaddWeakListener(AbstractProperty.ValueChangeListener<? super T> listener) Adds a weak listener that listens only for changes to this preference key.get()Replies the value of this property.Replies the default value of this property.Get the wrapped property.Get the fallback property.booleanisSet()Determines if this property is currently set in JOSM preferences.booleanSets this property to the specified value.voidremove()Removes this property from JOSM preferences (i.e replace it by its default value).protected voidprotected voidStore the default value to the preferences.Methods inherited from class org.openstreetmap.josm.data.preferences.AbstractProperty
addListener, cached, equals, getKey, getPreferences, hashCode, removeListener
-
Field Details
-
property
-
fallback
-
-
Constructor Details
-
FallbackProperty
Constructs a newFallbackProperty.- Parameters:
property- the wrapped propertyfallback- fallback property that takes effect in theget()method whenpropertyis not set
-
-
Method Details
-
getDelegateProperty
Get the wrapped property.- Returns:
- the wrapped property
-
getFallbackProperty
Get the fallback property.- Returns:
- the fallback property
-
storeDefaultValue
Description copied from class:AbstractPropertyStore the default value to the preferences.- Overrides:
storeDefaultValuein classAbstractProperty<T>
-
isSet
Description copied from class:AbstractPropertyDetermines if this property is currently set in JOSM preferences.- Overrides:
isSetin classAbstractProperty<T>- Returns:
- true if
getPreferences()contains this property.
-
getDefaultValue
Description copied from class:AbstractPropertyReplies the default value of this property.- Overrides:
getDefaultValuein classAbstractProperty<T>- Returns:
- The default value of this property
-
remove
Description copied from class:AbstractPropertyRemoves this property from JOSM preferences (i.e replace it by its default value).- Overrides:
removein classAbstractProperty<T>
-
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)
-
addListenerImpl
- Overrides:
addListenerImplin classAbstractProperty<T>
-
addWeakListener
Description copied from class:AbstractPropertyAdds a weak listener that listens only for changes to this preference key.- Overrides:
addWeakListenerin classAbstractProperty<T>- Parameters:
listener- The listener to add.
-
removeListenerImpl
- Overrides:
removeListenerImplin classAbstractProperty<T>
-