Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
BaseExecutorManager |
|
| 1.5;1,5 |
1 | /* | |
2 | * This file is part of AceLogger. | |
3 | * | |
4 | * AceLogger is free software: you can redistribute it and/or modify it under the terms of the GNU | |
5 | * Lesser General Public License as published by the Free Software Foundation, either version 3 of | |
6 | * the License, or (at your option) any later version. | |
7 | * | |
8 | * AceLogger is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without | |
9 | * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
10 | * Lesser General Public License for more details. | |
11 | * | |
12 | * You should have received a copy of the GNU Lesser General Public License along with AceLogger. | |
13 | * If not, see <http://www.gnu.org/licenses/lgpl-3.0.html>. | |
14 | */ | |
15 | package net.sourceforge.acelogger.execution.manager; | |
16 | ||
17 | import java.util.List; | |
18 | ||
19 | /** | |
20 | * Abstracts all common tasks for {@link ExecutorManager}. | |
21 | * | |
22 | * @author Zardi (https://sourceforge.net/users/daniel_zardi) | |
23 | * @version 1.0.0 | |
24 | * @since 1.0.0 | |
25 | */ | |
26 | public abstract class BaseExecutorManager implements ExecutorManager { | |
27 | ||
28 | /** | |
29 | * The identifier of this executor manager. | |
30 | */ | |
31 | private String identifier; | |
32 | ||
33 | /** | |
34 | * Constructs a new BaseExecutorManager with the supplied identifier. | |
35 | * | |
36 | * @param identitifer | |
37 | * The string that identifies this executor manager. | |
38 | * @since 1.0.0 | |
39 | */ | |
40 | 2 | public BaseExecutorManager(String identitifer) { |
41 | 2 | setIdentifier(identitifer); |
42 | 2 | } |
43 | ||
44 | /** {@inheritDoc} */ | |
45 | public final String getIdentifier() { | |
46 | 3 | return identifier; |
47 | } | |
48 | ||
49 | /** | |
50 | * Sets the string that identifies this object. | |
51 | * | |
52 | * @param identifier | |
53 | * The identifier of this object. | |
54 | * @since 1.0.0 | |
55 | */ | |
56 | private void setIdentifier(String identifier) { | |
57 | 2 | if (identifier == null) { |
58 | 0 | this.identifier = ""; |
59 | } else { | |
60 | 2 | this.identifier = identifier; |
61 | } | |
62 | 2 | } |
63 | ||
64 | /** {@inheritDoc} */ | |
65 | public void executeAll(List<Runnable> commands) { | |
66 | 1 | for (Runnable currentCommand : commands) { |
67 | 0 | execute(currentCommand); |
68 | } | |
69 | 1 | } |
70 | ||
71 | } |