Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
IPropertiesManager |
|
| 1.0;1 |
1 | package org.jtheque.core.managers.properties; | |
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 org.jtheque.core.managers.ActivableManager; | |
20 | ||
21 | /** | |
22 | * A properties manager specification. | |
23 | * | |
24 | * @author Baptiste Wicht | |
25 | */ | |
26 | public interface IPropertiesManager extends ActivableManager { | |
27 | /** | |
28 | * Create a memento for the bean. A memento is a clone of all the properties of the bean. | |
29 | * <p/> | |
30 | * Note : The properties of the Object class are not retrieved. | |
31 | * | |
32 | * @param bean The bean to create the memento from. | |
33 | * @param <T> The class of the bean. | |
34 | * @return The memento. | |
35 | */ | |
36 | <T> T createMemento(T bean); | |
37 | ||
38 | /** | |
39 | * Generate a toString() String based on all the properties of the bean. | |
40 | * <p/> | |
41 | * Note : The properties of the Object class are not retrieved. | |
42 | * | |
43 | * @param bean The bean. | |
44 | * @return A String representation of all the properties of the bean. | |
45 | */ | |
46 | String toString(Object bean); | |
47 | ||
48 | /** | |
49 | * Restore the state of the memento. It seems to copy all the properties values from the memento to the bean. | |
50 | * <p/> | |
51 | * Note : The properties of the Object class are not retrieved. | |
52 | * | |
53 | * @param bean The bean. | |
54 | * @param memento The memento. | |
55 | */ | |
56 | void restoreMemento(Object bean, Object memento); | |
57 | ||
58 | /** | |
59 | * Test if two object are equals referring to a certain list of properties. | |
60 | * | |
61 | * @param bean The first bean. | |
62 | * @param other The other bean. | |
63 | * @param properties The properties to use. | |
64 | * | |
65 | * @return <code>true</code> if the two objects are equals else <code>false</code>. | |
66 | */ | |
67 | boolean areEquals(Object bean, Object other, String... properties); | |
68 | ||
69 | /** | |
70 | * Return the value of the property. This method parse the entire class, but use a cache, so it's better to | |
71 | * use it when we have to access a lot of times the same class. | |
72 | * | |
73 | * @param bean The bean to get the property value from. | |
74 | * @param property The property. | |
75 | * | |
76 | * @return the value of the property. | |
77 | */ | |
78 | Object getProperty(Object bean, String property); | |
79 | ||
80 | /** | |
81 | * Return the value of the property. This method doesn't parse the entire class, so it's quicker than | |
82 | * getProperty() but it doesn't use cache so if you've to use it many times, use getProperty(). | |
83 | * | |
84 | * @param bean The bean to get the property value from. | |
85 | * @param property The property. | |
86 | * | |
87 | * @return the value of the property. | |
88 | */ | |
89 | Object getPropertyQuickly(Object bean, String property); | |
90 | } |