Class IntegerProperty
- java.lang.Object
-
- org.openstreetmap.josm.data.preferences.AbstractProperty<T>
-
- org.openstreetmap.josm.data.preferences.AbstractToStringProperty<java.lang.Integer>
-
- org.openstreetmap.josm.data.preferences.IntegerProperty
-
public class IntegerProperty extends AbstractToStringProperty<java.lang.Integer>
A property containing anInteger
value.- Since:
- 3246
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.openstreetmap.josm.data.preferences.AbstractToStringProperty
AbstractToStringProperty.ChildProperty<T>
-
Nested classes/interfaces inherited from class org.openstreetmap.josm.data.preferences.AbstractProperty
AbstractProperty.InvalidPreferenceValueException, AbstractProperty.ValueChangeEvent<T>, AbstractProperty.ValueChangeListener<T>
-
-
Field Summary
-
Fields inherited from class org.openstreetmap.josm.data.preferences.AbstractProperty
defaultValue, key, preferences
-
-
Constructor Summary
Constructors Constructor Description IntegerProperty(java.lang.String key, int defaultValue)
Constructs a newIntegerProperty
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.Integer
fromString(java.lang.String string)
Converts the string to an object of the given type.java.lang.Integer
get()
Replies the value of this property.boolean
parseAndPut(java.lang.String value)
parses and saves an integer valueboolean
put(java.lang.Integer value)
Sets this property to the specified value.protected java.lang.String
toString(java.lang.Integer t)
Converts the string to an object of the given type.-
Methods inherited from class org.openstreetmap.josm.data.preferences.AbstractToStringProperty
getAsString, getChildProperty, getSpecialized
-
Methods inherited from class org.openstreetmap.josm.data.preferences.AbstractProperty
addListener, addListenerImpl, addWeakListener, cached, equals, getDefaultValue, getKey, getPreferences, hashCode, isSet, remove, removeListener, removeListenerImpl, storeDefaultValue
-
-
-
-
Constructor Detail
-
IntegerProperty
public IntegerProperty(java.lang.String key, int defaultValue)
Constructs a newIntegerProperty
.- Parameters:
key
- The property keydefaultValue
- The default value
-
-
Method Detail
-
get
public java.lang.Integer get()
Description copied from class:AbstractProperty
Replies the value of this property.- Overrides:
get
in classAbstractToStringProperty<java.lang.Integer>
- Returns:
- the value of this property
-
put
public boolean put(java.lang.Integer value)
Description copied from class:AbstractProperty
Sets this property to the specified value.- Overrides:
put
in classAbstractToStringProperty<java.lang.Integer>
- Parameters:
value
- The new value of this property- Returns:
- true if something has changed (i.e. value is different than before)
-
fromString
protected java.lang.Integer fromString(java.lang.String string)
Description copied from class:AbstractToStringProperty
Converts the string to an object of the given type.- Specified by:
fromString
in classAbstractToStringProperty<java.lang.Integer>
- Parameters:
string
- The string- Returns:
- The object.
-
toString
protected java.lang.String toString(java.lang.Integer t)
Description copied from class:AbstractToStringProperty
Converts the string to an object of the given type.- Specified by:
toString
in classAbstractToStringProperty<java.lang.Integer>
- Parameters:
t
- The object.- Returns:
- The string representing the object
-
parseAndPut
public boolean parseAndPut(java.lang.String value)
parses and saves an integer value- Parameters:
value
- the value to be parsed- Returns:
- true - preference value has changed false - parsing failed or preference value has not changed
-
-