1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.configuration.internal; |
21 |
|
|
22 |
|
import java.util.ArrayList; |
23 |
|
import java.util.LinkedHashSet; |
24 |
|
import java.util.List; |
25 |
|
import java.util.Set; |
26 |
|
|
27 |
|
import org.xwiki.configuration.ConfigurationSource; |
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
@version |
34 |
|
@since |
35 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (58) |
Complexity: 13 |
Complexity Density: 0.34 |
|
36 |
|
public abstract class AbstractCompositeConfigurationSource extends AbstractConfigurationSource |
37 |
|
implements Iterable<ConfigurationSource> |
38 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
39 |
423791 |
@Override... |
40 |
|
public boolean containsKey(String key) |
41 |
|
{ |
42 |
423783 |
boolean result = false; |
43 |
|
|
44 |
423814 |
for (ConfigurationSource source : this) { |
45 |
519541 |
if (source.containsKey(key)) { |
46 |
532 |
result = true; |
47 |
532 |
break; |
48 |
|
} |
49 |
|
} |
50 |
|
|
51 |
423785 |
return result; |
52 |
|
} |
53 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
54 |
13444 |
@Override... |
55 |
|
public <T> T getProperty(String key) |
56 |
|
{ |
57 |
13444 |
T result = null; |
58 |
|
|
59 |
13429 |
for (ConfigurationSource source : this) { |
60 |
39989 |
if (source.containsKey(key)) { |
61 |
80 |
result = source.<T>getProperty(key); |
62 |
80 |
break; |
63 |
|
} |
64 |
|
} |
65 |
|
|
66 |
13446 |
return result; |
67 |
|
} |
68 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 3 |
Complexity Density: 0.38 |
|
69 |
18219 |
@Override... |
70 |
|
public <T> T getProperty(String key, Class<T> valueClass) |
71 |
|
{ |
72 |
18218 |
T result = null; |
73 |
|
|
74 |
18216 |
for (ConfigurationSource source : this) { |
75 |
53736 |
if (source.containsKey(key)) { |
76 |
5 |
result = source.getProperty(key, valueClass); |
77 |
5 |
break; |
78 |
|
} |
79 |
|
} |
80 |
|
|
81 |
|
|
82 |
18219 |
if (result == null) { |
83 |
18213 |
result = getDefault(valueClass); |
84 |
|
} |
85 |
|
|
86 |
18218 |
return result; |
87 |
|
} |
88 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 3 |
Complexity Density: 0.38 |
|
89 |
181118 |
@Override... |
90 |
|
public <T> T getProperty(String key, T defaultValue) |
91 |
|
{ |
92 |
181100 |
T result = null; |
93 |
|
|
94 |
181091 |
for (ConfigurationSource source : this) { |
95 |
361701 |
if (source.containsKey(key)) { |
96 |
1067 |
result = source.<T>getProperty(key, defaultValue); |
97 |
1067 |
break; |
98 |
|
} |
99 |
|
} |
100 |
|
|
101 |
181143 |
if (result == null) { |
102 |
180071 |
result = defaultValue; |
103 |
|
} |
104 |
|
|
105 |
181138 |
return result; |
106 |
|
} |
107 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
|
108 |
40 |
@Override... |
109 |
|
public List<String> getKeys() |
110 |
|
{ |
111 |
|
|
112 |
40 |
Set<String> keys = new LinkedHashSet<String>(); |
113 |
|
|
114 |
40 |
for (ConfigurationSource source : this) { |
115 |
53 |
keys.addAll(source.getKeys()); |
116 |
|
} |
117 |
|
|
118 |
40 |
return new ArrayList<String>(keys); |
119 |
|
} |
120 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (8) |
Complexity: 2 |
Complexity Density: 0.33 |
|
121 |
5 |
@Override... |
122 |
|
public boolean isEmpty() |
123 |
|
{ |
124 |
5 |
boolean result = true; |
125 |
|
|
126 |
5 |
for (ConfigurationSource source : this) { |
127 |
6 |
if (!source.isEmpty()) { |
128 |
3 |
result = false; |
129 |
3 |
break; |
130 |
|
} |
131 |
|
} |
132 |
|
|
133 |
5 |
return result; |
134 |
|
} |
135 |
|
} |