T
- the type of the option's valuepublic abstract class Preference<T> extends java.lang.Object implements PreferenceableOption.PreferenceableOption2<T>
BooleanPreference
,
ClassPreference
,
EnumerationPreference
,
IntegerPreference
PreferenceableOption.Listener, PreferenceableOption.PreferenceableOption2<T>
Modifier and Type | Field and Description |
---|---|
T |
defaultValue |
java.lang.String |
key |
java.lang.String |
pluginId |
Constructor and Description |
---|
Preference(java.lang.String pluginId,
java.lang.String key,
T defaultValue) |
Modifier and Type | Method and Description |
---|---|
void |
addListener(PreferenceableOption.Listener listener)
Add a listener to be notified of changes.
|
void |
fireChanged(java.lang.String key,
java.lang.Object oldValue,
java.lang.Object newValue)
Call-back notification that the Eclipse preference identified by a key, has changed from
oldValue to new Value.
|
T |
getDefaultValue()
Obtains the option's default value.
|
java.lang.String |
getKey()
Obtains my string key, which may be used for persistence in a
preference store.
|
java.lang.String |
getPluginId()
Returns the plugin qualifier for the key.
|
T |
getPreferredValue()
Get the preferred value of this option.
|
void |
removeListener(PreferenceableOption.Listener listener)
Remove a listener to be notified of changes.
|
void |
setDefaultValue(T defaultValue) |
java.lang.String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getValueOf
public final java.lang.String pluginId
public final java.lang.String key
public T defaultValue
public Preference(@NonNull java.lang.String pluginId, @NonNull java.lang.String key, @Nullable T defaultValue)
public void addListener(@NonNull PreferenceableOption.Listener listener)
PreferenceableOption.PreferenceableOption2
addListener
in interface PreferenceableOption.PreferenceableOption2<T>
public void fireChanged(java.lang.String key, java.lang.Object oldValue, java.lang.Object newValue)
PreferenceableOption.PreferenceableOption2
fireChanged
in interface PreferenceableOption.PreferenceableOption2<T>
@NonNull public java.lang.String getKey()
getKey
in interface PreferenceableOption<T>
null
@NonNull public java.lang.String getPluginId()
PreferenceableOption
getPluginId
in interface PreferenceableOption<T>
@Nullable public T getDefaultValue()
getDefaultValue
in interface PreferenceableOption<T>
null
@Nullable public T getPreferredValue()
getPreferredValue
in interface PreferenceableOption.PreferenceableOption2<T>
public void removeListener(@NonNull PreferenceableOption.Listener listener)
PreferenceableOption.PreferenceableOption2
removeListener
in interface PreferenceableOption.PreferenceableOption2<T>
public void setDefaultValue(@Nullable T defaultValue)
public java.lang.String toString()
toString
in class java.lang.Object