Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
Deleter |
|
| 1.0;1 |
1 | package org.jtheque.primary.view.impl.choice; | |
2 | ||
3 | import org.jtheque.core.managers.persistence.able.Entity; | |
4 | ||
5 | /* | |
6 | * This file is part of JTheque. | |
7 | * | |
8 | * JTheque is free software: you can redistribute it and/or modify | |
9 | * it under the terms of the GNU General Public License as published by | |
10 | * the Free Software Foundation, either version 3 of the License. | |
11 | * | |
12 | * JTheque is distributed in the hope that it will be useful, | |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | * GNU General Public License for more details. | |
16 | * | |
17 | * You should have received a copy of the GNU General Public License | |
18 | * along with JTheque. If not, see <http://www.gnu.org/licenses/>. | |
19 | */ | |
20 | ||
21 | /** | |
22 | * A deleter. It's an object who can delete a certain type of object. | |
23 | * | |
24 | * @author Baptiste Wicht | |
25 | */ | |
26 | public abstract class Deleter<T extends Entity> { | |
27 | private final String content; | |
28 | ||
29 | /** | |
30 | * Construct a new <code>Deleter</code> | |
31 | * | |
32 | * @param content The content to delete. | |
33 | */ | |
34 | public Deleter(String content){ | |
35 | 0 | super(); |
36 | ||
37 | 0 | this.content = content; |
38 | 0 | } |
39 | ||
40 | /** | |
41 | * Indicate if this deleter can delete the specified content or not. | |
42 | * | |
43 | * @param content The content to delete. | |
44 | * | |
45 | * @return <code>true</code> if the deleter can delete this content else <code>false</code>. | |
46 | */ | |
47 | public final boolean canDelete(String content){ | |
48 | 0 | return this.content.equals(content); |
49 | } | |
50 | ||
51 | /** | |
52 | * Delete the object. | |
53 | * | |
54 | * @param item The object to delete. | |
55 | */ | |
56 | public final void delete(Object item){ | |
57 | 0 | delete((T) item); |
58 | 0 | } |
59 | ||
60 | /** | |
61 | * Delete the specified item. | |
62 | * | |
63 | * @param item The item to delete. | |
64 | */ | |
65 | public abstract void delete(T item); | |
66 | } |