1 package com.explosion.utilities.preferences.persist;
2
3 import com.explosion.utilities.preferences.Preference;
4 import com.explosion.utilities.preferences.groups.PreferencePersistenceException;
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28 /***
29 * @author Stephen Cowx
30 * Created on 14-Mar-2005
31 */
32 public interface PreferencePersister
33 {
34
35 public static final String ITEM_COUNT = "count";
36 public static final String ITEM_NAME = "item_";
37
38 /***
39 * Returns a reference to the backing store as understood by the PreferencePersister
40 * @return
41 */
42 public Object getReferenceToStore();
43
44 /***
45 * Sets the reference to the backing store as understood by the PreferencePersister
46 * Effectively moving it from one store to another or moving it from one location in the same store to another
47 * @return
48 */
49 public void setReferenceToStore(Object referenceToStore);
50
51 /***
52 * This method saves the property to preference storage, if the value is
53 * null, it should delete the entire key/value pair persisted if it exists
54 * or not save it if it does.
55 *
56 * @throws Exception
57 */
58 public void save(Preference preference) throws PreferencePersistenceException;
59
60 /***
61 * This method loads the preference from persistent storage if it is there, if
62 * it is not it should not populate the value.
63 *
64 * @throws Exception
65 */
66 public void load(Preference preference) throws PreferencePersistenceException;
67
68 }