T
- The type of object accessed by this propertypublic abstract class AbstractProperty<T> extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
AbstractProperty.InvalidPreferenceValueException
An exception that is thrown if a preference value is invalid.
|
private class |
AbstractProperty.PreferenceChangedListenerAdapter |
static class |
AbstractProperty.ValueChangeEvent<T>
An event that is triggered if the value of a property changes.
|
static interface |
AbstractProperty.ValueChangeListener<T>
A listener that listens to changes in the properties value.
|
Modifier and Type | Field and Description |
---|---|
protected T |
defaultValue |
protected java.lang.String |
key |
protected Preferences |
preferences
The preferences object this property is for.
|
Constructor and Description |
---|
AbstractProperty(java.lang.String key,
T defaultValue)
Constructs a new
AbstractProperty . |
Modifier and Type | Method and Description |
---|---|
void |
addListener(AbstractProperty.ValueChangeListener<? super T> listener)
Adds a listener that listens only for changes to this preference key.
|
protected void |
addListenerImpl(Preferences.PreferenceChangedListener adapter) |
void |
addWeakListener(AbstractProperty.ValueChangeListener<? super T> listener)
Adds a weak listener that listens only for changes to this preference key.
|
protected void |
addWeakListenerImpl(Preferences.PreferenceChangedListener adapter) |
boolean |
equals(java.lang.Object obj) |
abstract T |
get()
Replies the value of this property.
|
T |
getDefaultValue()
Replies the default value of this property.
|
java.lang.String |
getKey()
Replies the property key.
|
protected Preferences |
getPreferences()
Gets the preferences used for this property.
|
int |
hashCode() |
boolean |
isSet()
Determines if this property is currently set in JOSM preferences.
|
abstract 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).
|
void |
removeListener(AbstractProperty.ValueChangeListener<? super T> listener)
Removes a listener that listens only for changes to this preference key.
|
protected void |
removeListenerImpl(Preferences.PreferenceChangedListener adapter) |
protected void |
storeDefaultValue()
Store the default value to
Preferences . |
protected final Preferences preferences
protected final java.lang.String key
protected final T defaultValue
public AbstractProperty(java.lang.String key, T defaultValue)
AbstractProperty
.key
- The property keydefaultValue
- The default valueprotected void storeDefaultValue()
Preferences
.public java.lang.String getKey()
public boolean isSet()
Main.pref
contains this property.public T getDefaultValue()
public void remove()
public abstract T get()
public abstract boolean put(T value)
value
- The new value of this propertyprotected Preferences getPreferences()
public void addListener(AbstractProperty.ValueChangeListener<? super T> listener)
listener
- The listener to add.protected void addListenerImpl(Preferences.PreferenceChangedListener adapter)
public void addWeakListener(AbstractProperty.ValueChangeListener<? super T> listener)
listener
- The listener to add.protected void addWeakListenerImpl(Preferences.PreferenceChangedListener adapter)
public void removeListener(AbstractProperty.ValueChangeListener<? super T> listener)
listener
- The listener to add.protected void removeListenerImpl(Preferences.PreferenceChangedListener adapter)
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object