T - The content typepublic class FallbackProperty<T> extends AbstractProperty<T>
AbstractProperty.InvalidPreferenceValueException, AbstractProperty.ValueChangeEvent<T>, AbstractProperty.ValueChangeListener<T>| Modifier and Type | Field and Description |
|---|---|
private AbstractProperty<T> |
fallback |
private AbstractProperty<T> |
property |
defaultValue, key, preferences| Constructor and Description |
|---|
FallbackProperty(AbstractProperty<T> property,
AbstractProperty<T> fallback)
Constructs a new
FallbackProperty. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addListenerImpl(PreferenceChangedListener adapter) |
void |
addWeakListener(AbstractProperty.ValueChangeListener<? super T> listener)
Adds a weak listener that listens only for changes to this preference key.
|
T |
get()
Replies the value of this property.
|
T |
getDefaultValue()
Replies the default value of this property.
|
AbstractProperty<T> |
getDelegateProperty()
Get the wrapped property.
|
AbstractProperty<T> |
getFallbackProperty()
Get the fallback property.
|
boolean |
isSet()
Determines if this property is currently set in JOSM preferences.
|
boolean |
put(T value)
Sets this property to the specified value.
|
void |
remove()
Removes this property from JOSM preferences (i.e replace it by its default value).
|
protected void |
removeListenerImpl(PreferenceChangedListener adapter) |
protected void |
storeDefaultValue()
Store the default value to the preferences.
|
addListener, cached, equals, getKey, getPreferences, hashCode, removeListenerprivate final AbstractProperty<T> property
private final AbstractProperty<T> fallback
public FallbackProperty(AbstractProperty<T> property, AbstractProperty<T> fallback)
FallbackProperty.property - the wrapped propertyfallback - fallback property that takes effect in the get() method when
property is not setpublic AbstractProperty<T> getDelegateProperty()
public AbstractProperty<T> getFallbackProperty()
protected void storeDefaultValue()
AbstractPropertystoreDefaultValue in class AbstractProperty<T>public boolean isSet()
AbstractPropertyisSet in class AbstractProperty<T>getPreferences() contains this property.public T getDefaultValue()
AbstractPropertygetDefaultValue in class AbstractProperty<T>public void remove()
AbstractPropertyremove in class AbstractProperty<T>public T get()
AbstractPropertyget in class AbstractProperty<T>public boolean put(T value)
AbstractPropertyput in class AbstractProperty<T>value - The new value of this propertyprotected void addListenerImpl(PreferenceChangedListener adapter)
addListenerImpl in class AbstractProperty<T>public void addWeakListener(AbstractProperty.ValueChangeListener<? super T> listener)
AbstractPropertyaddWeakListener in class AbstractProperty<T>listener - The listener to add.protected void removeListenerImpl(PreferenceChangedListener adapter)
removeListenerImpl in class AbstractProperty<T>