Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
UpdatableState |
|
| 2.0;2 |
1 | package org.jtheque.core.managers.update; | |
2 | ||
3 | import org.jtheque.core.managers.state.AbstractState; | |
4 | import org.jtheque.utils.bean.Version; | |
5 | ||
6 | /* | |
7 | * This file is part of JTheque. | |
8 | * | |
9 | * JTheque is free software: you can redistribute it and/or modify | |
10 | * it under the terms of the GNU General Public License as published by | |
11 | * the Free Software Foundation, either version 3 of the License. | |
12 | * | |
13 | * JTheque is distributed in the hope that it will be useful, | |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | * GNU General Public License for more details. | |
17 | * | |
18 | * You should have received a copy of the GNU General Public License | |
19 | * along with JTheque. If not, see <http://www.gnu.org/licenses/>. | |
20 | */ | |
21 | ||
22 | /** | |
23 | * A state for the updatables versions. | |
24 | * | |
25 | * @author Baptiste Wicht | |
26 | */ | |
27 | //Must be public for StateManager | |
28 | 0 | public final class UpdatableState extends AbstractState { |
29 | /** | |
30 | * Return the version of the updatable. | |
31 | * | |
32 | * @param name The name of the updatable. | |
33 | * @return The version of the updatable. | |
34 | */ | |
35 | public Version getVersion(String name) { | |
36 | 0 | String property = getProperty(name, "null"); |
37 | ||
38 | 0 | if ("null".equals(property)) { |
39 | 0 | return null; |
40 | } | |
41 | ||
42 | 0 | return new Version(property); |
43 | } | |
44 | ||
45 | /** | |
46 | * Set the version of the updatable. | |
47 | * | |
48 | * @param name The name of the updatable. | |
49 | * @param version The version of the updatable. | |
50 | */ | |
51 | public void setVersion(String name, Version version) { | |
52 | 0 | setProperty(name, version.getVersion()); |
53 | 0 | } |
54 | } |