Skip to content

Package: Configuration

Configuration

nameinstructionbranchcomplexitylinemethod
Configuration()
M: 0 C: 8
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
get(ConfigParam)
M: 8 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
get(ConfigParam, String)
M: 11 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
get(String)
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
get(String, String)
M: 0 C: 7
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
is(ConfigParam)
M: 0 C: 8
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
is(String)
M: 0 C: 9
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
set(ConfigParam, String)
M: 0 C: 11
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
set(String, String)
M: 10 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 3 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /**
2: * Copyright (C) 2016 Czech Technical University in Prague
3: *
4: * This program is free software: you can redistribute it and/or modify it under
5: * the terms of the GNU General Public License as published by the Free Software
6: * Foundation, either version 3 of the License, or (at your option) any
7: * later version.
8: *
9: * This program is distributed in the hope that it will be useful, but WITHOUT
10: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11: * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12: * details. You should have received a copy of the GNU General Public License
13: * along with this program. If not, see <http://www.gnu.org/licenses/>.
14: */
15: package cz.cvut.kbss.jsonld;
16:
17: import java.util.HashMap;
18: import java.util.Map;
19: import java.util.Objects;
20:
21: /**
22: * Contains configuration of the tool.
23: */
24: public class Configuration {
25:
26: private final Map<String, String> config = new HashMap<>();
27:
28: public String get(ConfigParam param) {
29: Objects.requireNonNull(param);
30: return get(param.getName());
31: }
32:
33: public String get(String param) {
34: return config.get(param);
35: }
36:
37: public String get(ConfigParam param, String defaultValue) {
38: Objects.requireNonNull(param);
39: return config.getOrDefault(param.getName(), defaultValue);
40: }
41:
42: public String get(String param, String defaultValue) {
43: return config.getOrDefault(param, defaultValue);
44: }
45:
46: public boolean is(ConfigParam param) {
47: Objects.requireNonNull(param);
48: return is(param.getName());
49: }
50:
51: public boolean is(String param) {
52: final String value = get(param, Boolean.FALSE.toString());
53: return Boolean.parseBoolean(value);
54: }
55:
56: public void set(ConfigParam param, String value) {
57: Objects.requireNonNull(param);
58: config.put(param.getName(), value);
59: }
60:
61: public void set(String param, String value) {
62: Objects.requireNonNull(param);
63: config.put(param, value);
64: }
65: }