T
- The property content type.public abstract class AbstractToStringProperty<T> extends AbstractProperty<T>
Modifier and Type | Class and Description |
---|---|
static class |
AbstractToStringProperty.ChildProperty<T>
This is a version of this property that attempts to get the property with a more specialized key and - if that fails - uses the property
value as default.
|
AbstractProperty.InvalidPreferenceValueException, AbstractProperty.ValueChangeEvent<T>, AbstractProperty.ValueChangeListener<T>
defaultValue, key, preferences
Constructor and Description |
---|
AbstractToStringProperty(java.lang.String key,
T defaultValue)
Create a new property and store the default value.
|
Modifier and Type | Method and Description |
---|---|
CachingProperty<T> |
cached()
Creates a new
CachingProperty instance for this property. |
protected abstract T |
fromString(java.lang.String string)
Converts the string to an object of the given type.
|
T |
get()
Replies the value of this property.
|
protected java.lang.String |
getAsString()
Gets the preference value as String.
|
protected AbstractToStringProperty<T> |
getChildProperty(java.lang.String key)
Gets a setting that defaults to this setting if the key is not set.
|
AbstractToStringProperty<T> |
getSpecialized(java.lang.String spec)
Gets a specialized setting value that has the current value as default
|
boolean |
put(T value)
Sets this property to the specified value.
|
protected abstract java.lang.String |
toString(T t)
Converts the string to an object of the given type.
|
addListener, addListenerImpl, addWeakListener, addWeakListenerImpl, equals, getDefaultValue, getKey, getPreferences, hashCode, isSet, remove, removeListener, removeListenerImpl, storeDefaultValue
public AbstractToStringProperty(java.lang.String key, T defaultValue)
key
- The keydefaultValue
- The default value.AbstractProperty.AbstractProperty(String, Object)
public T get()
AbstractProperty
get
in class AbstractProperty<T>
protected abstract T fromString(java.lang.String string)
string
- The stringInvalidPreferenceValueException
- If the value could not be converted.public boolean put(T value)
AbstractProperty
put
in class AbstractProperty<T>
value
- The new value of this propertyprotected abstract java.lang.String toString(T t)
t
- The object.InvalidPreferenceValueException
- If the value could not be converted.protected java.lang.String getAsString()
public AbstractToStringProperty<T> getSpecialized(java.lang.String spec)
The key will be getKey().spec
spec
- The key specializationprotected AbstractToStringProperty<T> getChildProperty(java.lang.String key)
key
- The more specialized key.public CachingProperty<T> cached()
CachingProperty
instance for this property.