org.eclipse.cdt.core.options

## Class OsgiPreferenceStorage

- java.lang.Object
- - org.eclipse.cdt.core.options.OsgiPreferenceStorage

All Implemented Interfaces:
  OptionStorage

    public final class OsgiPreferenceStorage
    extends Object
    implements OptionStorage

The option storage implementation that uses OSGi preference node as an enclosed storage.

See Also:
  `Preferences`

### Constructor Summary

Constructors
Constructor and Description
`OsgiPreferenceStorage(org.osgi.service.prefs.Preferences preferences)`

### Method Summary

All Methods Instance Methods Concrete Methods
`<V> boolean` `consumable(Class<V> valueType)` Checks if the value type can be consumed by an enclosed storage.
`<V> V` `load(OptionMetadata<V> option)` Loads the value of specified option from an enclosed storage.
`<V> void` `save(V value, OptionMetadata<V> option)` Saves the value of specified option to the enclosed storage.

### Methods inherited from class java.lang.Object

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

### Constructor Detail

#### OsgiPreferenceStorage

    public OsgiPreferenceStorage(org.osgi.service.prefs.Preferences preferences)

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

### Method Detail

#### consumable

    public <V> boolean consumable(Class<V> valueType)

Description copied from interface: `OptionStorage`
Checks if the value type can be consumed by an enclosed storage.

Specified by:
  `consumable` in interface `OptionStorage`
Type Parameters:
  `V` - the value type for the option
Parameters:
  `valueType` - the value type to be checked
Returns:
  true if this value type can be consumed by an enclosed storage and false otherwise

#### load

    public <V> V load(OptionMetadata<V> option)

Description copied from interface: `OptionStorage`
Loads the value of specified option from an enclosed storage. If the value is not found returns the option default value.

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

#### save

    public <V> void save(V value,
                         OptionMetadata<V> option)

Description copied from interface: `OptionStorage`
Saves the value of specified option to the enclosed storage.

Specified by:
  `save` in interface `OptionStorage`
Type Parameters:
  `V` - the value type for the option
Parameters:
  `value` - to be saved, must not be `null`.
  `option` - the option metadata, must not be `null`.
See Also:
  `OptionStorage.consumable(Class)`, `OptionMetadata`