Package org.eclipse.xtext.preferences
Class MapBasedPreferenceValues
- java.lang.Object
-
- org.eclipse.xtext.preferences.MapBasedPreferenceValues
-
- All Implemented Interfaces:
IPreferenceValues
,IPreferenceValuesProvider
,ITypedPreferenceValues
public class MapBasedPreferenceValues extends java.lang.Object implements ITypedPreferenceValues, IPreferenceValuesProvider
- Since:
- 2.26
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.xtext.preferences.IPreferenceValuesProvider
IPreferenceValuesProvider.DefaultPreferenceValuesProvider, IPreferenceValuesProvider.SimplePreferenceValuesProvider, IPreferenceValuesProvider.SingletonPreferenceValuesProvider
-
-
Constructor Summary
Constructors Constructor Description MapBasedPreferenceValues()
MapBasedPreferenceValues(java.util.Map<java.lang.String,java.lang.String> values)
MapBasedPreferenceValues(IPreferenceValues delegate, java.util.Map<java.lang.String,java.lang.String> values)
Creates preference values that are backed by the givenvalues
Map
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
IPreferenceValues
getDelegate()
java.lang.String
getPreference(PreferenceKey key)
<T> T
getPreference(TypedPreferenceKey<T> key)
IPreferenceValues
getPreferenceValues(org.eclipse.emf.ecore.resource.Resource context)
java.util.Map<java.lang.String,java.lang.String>
getValues()
void
put(java.lang.String key, java.lang.String value)
Put the given preference value under the given key into this store.void
put(PreferenceKey key, java.lang.Object value)
Put the given preference value under the given key into this store.<T> void
put(TypedPreferenceKey<T> key, T value)
Put the given preference value under the given key into this store.java.lang.String
toString()
-
-
-
Constructor Detail
-
MapBasedPreferenceValues
public MapBasedPreferenceValues(IPreferenceValues delegate, java.util.Map<java.lang.String,java.lang.String> values)
Creates preference values that are backed by the givenvalues
Map
. The values map is used as is. Subsequent changes tovalues
will be reflected by this preference instance and modifying operations on the preferences will be done on the given map.
-
MapBasedPreferenceValues
public MapBasedPreferenceValues(java.util.Map<java.lang.String,java.lang.String> values)
-
MapBasedPreferenceValues
public MapBasedPreferenceValues()
-
-
Method Detail
-
clear
public void clear()
-
getDelegate
public IPreferenceValues getDelegate()
-
getPreference
public java.lang.String getPreference(PreferenceKey key)
- Specified by:
getPreference
in interfaceIPreferenceValues
- Returns:
- the currently active value for the given preference or its default value, if no current value was explicitly defined.
- See Also:
PreferenceKey.getDefaultValue()
-
getPreference
public <T> T getPreference(TypedPreferenceKey<T> key)
- Specified by:
getPreference
in interfaceITypedPreferenceValues
- Returns:
- the currently active value for the given preference or its default value, if no current value was explicitly defined.
- See Also:
PreferenceKey.getDefaultValue()
-
getPreferenceValues
public IPreferenceValues getPreferenceValues(org.eclipse.emf.ecore.resource.Resource context)
- Specified by:
getPreferenceValues
in interfaceIPreferenceValuesProvider
-
getValues
public java.util.Map<java.lang.String,java.lang.String> getValues()
-
put
public void put(PreferenceKey key, java.lang.Object value)
Put the given preference value under the given key into this store. If the value is null, it's being removed from this store.
-
put
public void put(java.lang.String key, java.lang.String value)
Put the given preference value under the given key into this store. If the value is null, it's being removed from this store.
-
put
public <T> void put(TypedPreferenceKey<T> key, T value)
Put the given preference value under the given key into this store. If the value is null, it's being removed from this store.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-