# Class OsgiPreferenceMetadataStore

java.lang.Object
org.eclipse.core.runtime.preferences.OsgiPreferenceMetadataStore

All Implemented Interfaces:
  `IPreferenceMetadataStore`

public final class OsgiPreferenceMetadataStore extends Object implements IPreferenceMetadataStore
The preference store implementation that uses OSGi preference node as an enclosed storage.

Since:
  3.8
See Also:
  - `IEclipsePreferences`

## Constructor Summary

Constructors
Constructor
Description
`OsgiPreferenceMetadataStore(IEclipsePreferences preferences)`

## Method Summary

Modifier and Type
Method
Description
`<V> boolean`
`handles(Class<V> valueType)`
Checks if this value type can be handled by this preference store.
`<V> V`
`load(PreferenceMetadata<V> preference)`
Loads the value of specified preference from an enclosed storage.
`<V> void`
`save(V value, PreferenceMetadata<V> preference)`
Saves the value of specified preference to the enclosed storage.

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### OsgiPreferenceMetadataStore

public OsgiPreferenceMetadataStore(IEclipsePreferences preferences)

Parameters:
  `preferences` - the OSGi preference node, must not be `null`

## Method Details

### handles

public <V> boolean handles(Class<V> valueType)
Description copied from interface: `IPreferenceMetadataStore`
Checks if this value type can be handled by this preference store.

Specified by:
  `handles` in interface `IPreferenceMetadataStore`
Type Parameters:
  `V` - the value type for the preference
Parameters:
  `valueType` - the value type to be checked
Returns:
  true if this value type can be handled by this preference store and false otherwise

### load

public <V> V load(PreferenceMetadata<V> preference)
Description copied from interface: `IPreferenceMetadataStore`
Loads the value of specified preference from an enclosed storage. If the value is not found returns the preference default value.

Specified by:
  `load` in interface `IPreferenceMetadataStore`
Type Parameters:
  `V` - the value type for the preference
Parameters:
  `preference` - the preference metadata, must not be `null`.
Returns:
  the preference value or default value if preference is unknown
See Also:
  - `IPreferenceMetadataStore.handles(Class)`
  - `PreferenceMetadata`

### save

public <V> void save(V value, PreferenceMetadata<V> preference)
Description copied from interface: `IPreferenceMetadataStore`
Saves the value of specified preference to the enclosed storage.

Specified by:
  `save` in interface `IPreferenceMetadataStore`
Type Parameters:
  `V` - the value type for the preference
Parameters:
  `value` - to be saved, must not be `null`.
  `preference` - the preference metadata, must not be `null`.
See Also:
  - `IPreferenceMetadataStore.handles(Class)`
  - `PreferenceMetadata`