Package org.faceless.pdf2.viewer2.util
Class JsonPreferences
- java.lang.Object
-
- java.util.prefs.Preferences
-
- java.util.prefs.AbstractPreferences
-
- org.faceless.pdf2.viewer2.util.JsonPreferences
-
- Direct Known Subclasses:
WebswingPreferencesFactory.WebswingPreferences
public class JsonPreferences extends AbstractPreferences
A Preferences class backed with a Json structure. The sync() and flush() methods do nothing, and should be overriden The load() method will populate this object from a Json structure loaded elsewhere
-
-
Field Summary
-
Fields inherited from class java.util.prefs.AbstractPreferences
lock, newNode
-
Fields inherited from class java.util.prefs.Preferences
MAX_KEY_LENGTH, MAX_NAME_LENGTH, MAX_VALUE_LENGTH
-
-
Constructor Summary
Constructors Constructor Description JsonPreferences(AbstractPreferences parent, String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected String[]
childrenNamesSpi()
protected AbstractPreferences
childSpi(String name)
void
flush()
protected void
flushSpi()
protected String
getSpi(String key)
protected String[]
keysSpi()
void
load(Json j)
protected void
putSpi(String key, String value)
protected void
removeNodeSpi()
protected void
removeSpi(String key)
void
setAutoFlush(int ms)
Auto-save the preferences after the specified number of ms.void
sync()
protected void
syncSpi()
String
toString()
-
Methods inherited from class java.util.prefs.AbstractPreferences
absolutePath, addNodeChangeListener, addPreferenceChangeListener, cachedChildren, childrenNames, clear, exportNode, exportSubtree, get, getBoolean, getByteArray, getChild, getDouble, getFloat, getInt, getLong, isRemoved, isUserNode, keys, name, node, nodeExists, parent, put, putBoolean, putByteArray, putDouble, putFloat, putInt, putLong, remove, removeNode, removeNodeChangeListener, removePreferenceChangeListener
-
Methods inherited from class java.util.prefs.Preferences
importPreferences, systemNodeForPackage, systemRoot, userNodeForPackage, userRoot
-
-
-
-
Constructor Detail
-
JsonPreferences
public JsonPreferences(AbstractPreferences parent, String name)
-
-
Method Detail
-
setAutoFlush
public void setAutoFlush(int ms)
Auto-save the preferences after the specified number of ms. A number other than zero (eg 250) will batch up changes to the prefs before flushing. Zero to disable.
-
toString
public String toString()
- Overrides:
toString
in classAbstractPreferences
-
load
public void load(Json j)
-
putSpi
protected void putSpi(String key, String value)
- Specified by:
putSpi
in classAbstractPreferences
-
getSpi
protected String getSpi(String key)
- Specified by:
getSpi
in classAbstractPreferences
-
removeSpi
protected void removeSpi(String key)
- Specified by:
removeSpi
in classAbstractPreferences
-
removeNodeSpi
protected void removeNodeSpi()
- Specified by:
removeNodeSpi
in classAbstractPreferences
-
keysSpi
protected String[] keysSpi()
- Specified by:
keysSpi
in classAbstractPreferences
-
childrenNamesSpi
protected String[] childrenNamesSpi()
- Specified by:
childrenNamesSpi
in classAbstractPreferences
-
childSpi
protected AbstractPreferences childSpi(String name)
- Specified by:
childSpi
in classAbstractPreferences
-
syncSpi
protected void syncSpi()
- Specified by:
syncSpi
in classAbstractPreferences
-
flushSpi
protected void flushSpi()
- Specified by:
flushSpi
in classAbstractPreferences
-
flush
public void flush() throws BackingStoreException
- Overrides:
flush
in classAbstractPreferences
- Throws:
BackingStoreException
-
sync
public void sync()
- Overrides:
sync
in classAbstractPreferences
-
-