Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
IState |
|
| 1.0;1 |
1 | package org.jtheque.core.managers.state; | |
2 | ||
3 | /* | |
4 | * This file is part of JTheque. | |
5 | * | |
6 | * JTheque is free software: you can redistribute it and/or modify | |
7 | * it under the terms of the GNU General Public License as published by | |
8 | * the Free Software Foundation, either version 3 of the License. | |
9 | * | |
10 | * JTheque is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with JTheque. If not, see <http://www.gnu.org/licenses/>. | |
17 | */ | |
18 | ||
19 | import java.util.Collection; | |
20 | ||
21 | /** | |
22 | * A state. It's a persistent object manager by the state manager. This object permit to store certain property to | |
23 | * recover it after the application has been exited. | |
24 | * | |
25 | * @author Baptiste Wicht | |
26 | */ | |
27 | public interface IState { | |
28 | /** | |
29 | * Return the property referenced by a certain key. | |
30 | * | |
31 | * @param key The property key. | |
32 | * @return The property. | |
33 | */ | |
34 | String getProperty(String key); | |
35 | ||
36 | /** | |
37 | * Return the property referenced by a certain key or a default value if the property doesn't exist. | |
38 | * | |
39 | * @param key The property key. | |
40 | * @param defaults The default value if we don't find the property. | |
41 | * @return The property or the default value if the property doesn't exist. | |
42 | */ | |
43 | String getProperty(String key, String defaults); | |
44 | ||
45 | /** | |
46 | * Set the property. | |
47 | * | |
48 | * @param key The property key. | |
49 | * @param value The property value. | |
50 | */ | |
51 | void setProperty(String key, String value); | |
52 | ||
53 | /** | |
54 | * Return all the properties of the state. | |
55 | * | |
56 | * @return A List containing all the properties of the state. | |
57 | */ | |
58 | Collection<String> getProperties(); | |
59 | ||
60 | /** | |
61 | * Indicate if the write and read operations are delegated to the state or are standard managed by the | |
62 | * state manager. | |
63 | * | |
64 | * @return true if the operations are delegated else false. | |
65 | */ | |
66 | boolean isDelegated(); | |
67 | ||
68 | /** | |
69 | * Delegate the save. | |
70 | * | |
71 | * @return A List of NodeState to write. | |
72 | */ | |
73 | Collection<NodeState> delegateSave(); | |
74 | ||
75 | /** | |
76 | * Delegate the load. | |
77 | * | |
78 | * @param nodes The nodes of the state. | |
79 | */ | |
80 | void delegateLoad(Collection<NodeState> nodes); | |
81 | } |