org.openstreetmap.josm.data.preferences
Class AbstractProperty<T>

java.lang.Object
  extended by org.openstreetmap.josm.data.preferences.AbstractProperty<T>
Type Parameters:
T - The type of object accessed by this property
Direct Known Subclasses:
BooleanProperty, CachedProperty, CollectionProperty, ColorProperty, IntegerProperty, StringProperty

public abstract class AbstractProperty<T>
extends java.lang.Object

Captures the common functionality of preference properties


Field Summary
protected  T defaultValue
           
protected  java.lang.String key
           
 
Constructor Summary
AbstractProperty(java.lang.String key, T defaultValue)
          Constructs a new AbstractProperty.
 
Method Summary
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.
 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).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

key

protected final java.lang.String key

defaultValue

protected final T defaultValue
Constructor Detail

AbstractProperty

public AbstractProperty(java.lang.String key,
                        T defaultValue)
Constructs a new AbstractProperty.

Parameters:
key - The property key
defaultValue - The default value
Since:
5464
Method Detail

getKey

public java.lang.String getKey()
Replies the property key.

Returns:
The property key

isSet

public boolean isSet()
Determines if this property is currently set in JOSM preferences.

Returns:
true if Main.pref contains this property.

getDefaultValue

public T getDefaultValue()
Replies the default value of this property.

Returns:
The default value of this property

remove

public void remove()
Removes this property from JOSM preferences (i.e replace it by its default value).


get

public abstract T get()
Replies the value of this property.

Returns:
the value of this property
Since:
5464

put

public abstract boolean put(T value)
Sets this property to the specified value.

Parameters:
value - The new value of this property
Returns:
true if something has changed (i.e. value is different than before)
Since:
5464


JOSM