Package org.scijava.prefs
Class DefaultPrefService
- java.lang.Object
-
- org.scijava.AbstractContextual
-
- org.scijava.plugin.AbstractRichPlugin
-
- org.scijava.service.AbstractService
-
- org.scijava.prefs.AbstractPrefService
-
- org.scijava.prefs.DefaultPrefService
-
- All Implemented Interfaces:
Comparable<Prioritized>,Contextual,Disposable,Identifiable,Initializable,Locatable,Logged,HasPluginInfo,RichPlugin,SciJavaPlugin,PrefService,Prioritized,SciJavaService,Service,Versioned
public class DefaultPrefService extends AbstractPrefService
DefaultPrefServiceimplementation, which persists preferences to disk using thePreferencesAPI.- Author:
- Mark Hiner, Curtis Rueden, Grant Harris
-
-
Constructor Summary
Constructors Constructor Description DefaultPrefService()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidclear(Class<?> c)Deletes all of the givenClass's keys from persistent storage.voidclear(Class<?> c, String name)Deprecated.voidclear(String absolutePath, String key)Deprecated.voidclearAll()Deletes all information from the data store.Stringget(Class<?> c, String name, String defaultValue)Gets a persisted key as aString.booleangetBoolean(Class<?> c, String name, boolean defaultValue)Gets a persisted key as aboolean.doublegetDouble(Class<?> c, String name, double defaultValue)Gets a persisted key as adouble.floatgetFloat(Class<?> c, String name, float defaultValue)Gets a persisted key as afloat.intgetInt(Class<?> c, String name, int defaultValue)Gets a persisted key as anint.Iterable<String>getIterable(Class<?> c, String name)Deprecated.List<String>getList(Class<?> c)Deprecated.List<String>getList(Class<?> c, String name)Gets a persisted key as aList.List<String>getList(String absolutePath, String key)Deprecated.longgetLong(Class<?> c, String name, long defaultValue)Gets a persisted key as along.Map<String,String>getMap(Class<?> c)Deprecated.Map<String,String>getMap(Class<?> c, String name)Gets a persisted key as aMap.Map<String,String>getMap(String absolutePath, String key)Deprecated.voidput(Class<?> c, String name, boolean value)Saves a key/value pair in persistent storage.voidput(Class<?> c, String name, double value)Saves a key/value pair in persistent storage.voidput(Class<?> c, String name, float value)Saves a key/value pair in persistent storage.voidput(Class<?> c, String name, int value)Saves a key/value pair in persistent storage.voidput(Class<?> c, String name, long value)Saves a key/value pair in persistent storage.voidput(Class<?> c, String name, Iterable<String> value)Saves a key/value pair in persistent storage.voidput(Class<?> c, String name, String value)Saves a key/value pair in persistent storage.voidput(Class<?> c, String name, Map<String,String> value)Saves a key/value pair in persistent storage.voidputList(Class<?> c, List<String> list)Deprecated.voidputList(String absolutePath, List<String> list)Deprecated.voidputList(String absolutePath, List<String> list, String key)Deprecated.voidputMap(Class<?> c, Map<String,String> map)Deprecated.voidputMap(String absolutePath, Map<String,String> map)Deprecated.voidputMap(String absolutePath, Map<String,String> map, String key)Deprecated.voidremove(Class<?> c, String name)Deletes a key from persistent storage.voidremove(String absolutePath, String key)Deprecated.-
Methods inherited from class org.scijava.prefs.AbstractPrefService
initialize
-
Methods inherited from class org.scijava.service.AbstractService
getContext, setContext, toString
-
Methods inherited from class org.scijava.plugin.AbstractRichPlugin
getInfo, getPriority, setInfo, setPriority
-
Methods inherited from class org.scijava.AbstractContextual
context
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.scijava.Contextual
context, getContext, setContext
-
Methods inherited from interface org.scijava.Disposable
dispose
-
Methods inherited from interface org.scijava.plugin.HasPluginInfo
getInfo, setInfo
-
Methods inherited from interface org.scijava.Locatable
getLocation
-
Methods inherited from interface org.scijava.prefs.PrefService
clear, get, get, get, getBoolean, getDouble, getFloat, getInt, getIterable, getList, getLong, getMap, put, put, put, put, put, put, putIterable, putIterable, putList, putList, putMap, putMap
-
Methods inherited from interface org.scijava.Prioritized
compareTo, getPriority, setPriority
-
Methods inherited from interface org.scijava.plugin.RichPlugin
getIdentifier, log
-
Methods inherited from interface org.scijava.service.Service
registerEventHandlers
-
Methods inherited from interface org.scijava.Versioned
getVersion
-
-
-
-
Method Detail
-
get
public String get(Class<?> c, String name, String defaultValue)
Description copied from interface:PrefServiceGets a persisted key as aString.- Parameters:
c- The class with which the key is associated.name- The key to retrieve.defaultValue- The value to return if the key is not present.- Returns:
- The value of the key as a
String.
-
getBoolean
public boolean getBoolean(Class<?> c, String name, boolean defaultValue)
Description copied from interface:PrefServiceGets a persisted key as aboolean.- Parameters:
c- The class with which the key is associated.name- The key to retrieve.defaultValue- The value to return if the key is not present.- Returns:
- The value of the key as a
boolean.
-
getDouble
public double getDouble(Class<?> c, String name, double defaultValue)
Description copied from interface:PrefServiceGets a persisted key as adouble.- Parameters:
c- The class with which the key is associated.name- The key to retrieve.defaultValue- The value to return if the key is not present.- Returns:
- The value of the key as a
double.
-
getFloat
public float getFloat(Class<?> c, String name, float defaultValue)
Description copied from interface:PrefServiceGets a persisted key as afloat.- Parameters:
c- The class with which the key is associated.name- The key to retrieve.defaultValue- The value to return if the key is not present.- Returns:
- The value of the key as a
float.
-
getInt
public int getInt(Class<?> c, String name, int defaultValue)
Description copied from interface:PrefServiceGets a persisted key as anint.- Parameters:
c- The class with which the key is associated.name- The key to retrieve.defaultValue- The value to return if the key is not present.- Returns:
- The value of the key as an
int.
-
getLong
public long getLong(Class<?> c, String name, long defaultValue)
Description copied from interface:PrefServiceGets a persisted key as along.- Parameters:
c- The class with which the key is associated.name- The key to retrieve.defaultValue- The value to return if the key is not present.- Returns:
- The value of the key as an
long.
-
getMap
public Map<String,String> getMap(Class<?> c, String name)
Description copied from interface:PrefServiceGets a persisted key as aMap.- Parameters:
c- The class with which the key is associated.name- The key to retrieve.- Returns:
- The value of the key as an
Map, or null if the key is not present.
-
getList
public List<String> getList(Class<?> c, String name)
Description copied from interface:PrefServiceGets a persisted key as aList.- Parameters:
c- The class with which the key is associated.name- The key to retrieve.- Returns:
- The value of the key as an
List, or null if the key is not present.
-
put
public void put(Class<?> c, String name, String value)
Description copied from interface:PrefServiceSaves a key/value pair in persistent storage.- Parameters:
c- The class with which the key/value pair is associated.name- The key where the value should be stored.value- The value to store.- See Also:
PrefService.get(Class, String),PrefService.get(Class, String, String)
-
put
public void put(Class<?> c, String name, boolean value)
Description copied from interface:PrefServiceSaves a key/value pair in persistent storage.- Parameters:
c- The class with which the key/value pair is associated.name- The key where the value should be stored.value- The value to store.- See Also:
PrefService.getBoolean(Class, String, boolean)
-
put
public void put(Class<?> c, String name, double value)
Description copied from interface:PrefServiceSaves a key/value pair in persistent storage.- Parameters:
c- The class with which the key/value pair is associated.name- The key where the value should be stored.value- The value to store.- See Also:
PrefService.getDouble(Class, String, double)
-
put
public void put(Class<?> c, String name, float value)
Description copied from interface:PrefServiceSaves a key/value pair in persistent storage.- Parameters:
c- The class with which the key/value pair is associated.name- The key where the value should be stored.value- The value to store.- See Also:
PrefService.getFloat(Class, String, float)
-
put
public void put(Class<?> c, String name, int value)
Description copied from interface:PrefServiceSaves a key/value pair in persistent storage.- Parameters:
c- The class with which the key/value pair is associated.name- The key where the value should be stored.value- The value to store.- See Also:
PrefService.getInt(Class, String, int)
-
put
public void put(Class<?> c, String name, long value)
Description copied from interface:PrefServiceSaves a key/value pair in persistent storage.- Parameters:
c- The class with which the key/value pair is associated.name- The key where the value should be stored.value- The value to store.- See Also:
PrefService.getLong(Class, String, long)
-
put
public void put(Class<?> c, String name, Map<String,String> value)
Description copied from interface:PrefServiceSaves a key/value pair in persistent storage.- Parameters:
c- The class with which the key/value pair is associated.name- The key where the value should be stored.value- The value to store.- See Also:
PrefService.getMap(Class, String)
-
put
public void put(Class<?> c, String name, Iterable<String> value)
Description copied from interface:PrefServiceSaves a key/value pair in persistent storage.- Parameters:
c- The class with which the key/value pair is associated.name- The key where the value should be stored.value- The value to store.- See Also:
PrefService.getList(Class, String)
-
remove
public void remove(Class<?> c, String name)
Description copied from interface:PrefServiceDeletes a key from persistent storage.- Parameters:
c- The class with which the key is associated.name- The key to remove.
-
clear
public void clear(Class<?> c)
Description copied from interface:PrefServiceDeletes all of the givenClass's keys from persistent storage.- Parameters:
c- The class whose keys should be removed.
-
clearAll
public void clearAll()
Description copied from interface:PrefServiceDeletes all information from the data store. Use with care!
-
putMap
@Deprecated public void putMap(Class<?> c, Map<String,String> map)
Deprecated.
-
getMap
@Deprecated public Map<String,String> getMap(Class<?> c)
Deprecated.
-
putList
@Deprecated public void putList(Class<?> c, List<String> list)
Deprecated.
-
getList
@Deprecated public List<String> getList(Class<?> c)
Deprecated.
-
getIterable
@Deprecated public Iterable<String> getIterable(Class<?> c, String name)
Deprecated.
-
clear
@Deprecated public void clear(String absolutePath, String key)
Deprecated.
-
remove
@Deprecated public void remove(String absolutePath, String key)
Deprecated.
-
putMap
@Deprecated public void putMap(String absolutePath, Map<String,String> map, String key)
Deprecated.
-
putMap
@Deprecated public void putMap(String absolutePath, Map<String,String> map)
Deprecated.
-
putList
@Deprecated public void putList(String absolutePath, List<String> list, String key)
Deprecated.
-
putList
@Deprecated public void putList(String absolutePath, List<String> list)
Deprecated.
-
getList
@Deprecated public List<String> getList(String absolutePath, String key)
Deprecated.
-
clear
@Deprecated public void clear(Class<?> c, String name)
Deprecated.
-
-