|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface ObjectPreferences
A mirror of the Preferences API, built on top of it, that supports
storing and retrieving "small" objects.
| Method Summary | ||
|---|---|---|
void |
flush()
Refer too Preferences.flush() |
|
|
get(String key,
T defaultValue)
|
|
Preferences |
getNode()
The actual preferences node that is backing objects storing implementation. |
|
void |
put(String key,
Object value)
Saves an Object in the backing Preferences system, serializing it to either a binary o character stream, depending on the implementation. |
|
void |
remove(String key)
|
|
void |
sync()
|
|
| Method Detail |
|---|
void put(@NonNull
String key,
Object value)
throws org.apache.commons.lang.SerializationException
key - the key of the object to storevalue - the object that will be stored either using a binary or character
representation. More specific sizes must be defined by
implementors.
org.apache.commons.lang.SerializationException - if object can not be serializedPreferences.putByteArray(String, byte[]),
Preferences.put(String, String),
Preferences.MAX_VALUE_LENGTH
<T> T get(@NonNull
String key,
T defaultValue)
T - key - defaultValue -
ClassCastException - if the key exists and contains a valid object, but it can not be
casted to the desired <T>
void flush()
throws BackingStoreException
Preferences.flush()
BackingStoreException - if underlying Preferences throws it when flushing
void sync()
throws BackingStoreException
BackingStoreException - if underlying Preferences throws it when synchronizingPreferences#sync()}void remove(String key)
key - the key to removePreferences#remove(String)}@NonNull Preferences getNode()
The actual preferences node that is backing objects storing implementation.
Clients that want to store Strings, byte[] and primitives using
ObjectPreferences must never use the put(String, Object)
method, but the specific messages of the preferences node, for example:
objectPrefs.getNode().put("Hello", "World");
Preferences node this ObjectPreferences sits on
top
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||