1 | package fr.sii.ogham.core.builder.configuration; | |
2 | ||
3 | /** | |
4 | * If the new value should override the current value, the new value is | |
5 | * returned. If the new value should not override, the current value is | |
6 | * returned. | |
7 | * | |
8 | * @author Aurélien Baudet | |
9 | * | |
10 | * @param <V> | |
11 | * the type of the value | |
12 | */ | |
13 | public interface MayOverride<V> { | |
14 | ||
15 | /** | |
16 | * If the new value should override the current value, the new value is | |
17 | * returned. If the new value should not override, the current value is | |
18 | * returned. | |
19 | * | |
20 | * @param currentValue | |
21 | * the current value that may be overridden | |
22 | * @return the new value | |
23 | */ | |
24 | V override(V currentValue); | |
25 | ||
26 | /** | |
27 | * Override current value only if the value parameter is not {@code null}. | |
28 | * | |
29 | * @param <V> | |
30 | * the type of the value | |
31 | * @param value | |
32 | * the new value to set if not {@code null} | |
33 | * @return the override control | |
34 | */ | |
35 | static <V> MayOverride<V> overrideIfNonNull(V value) { | |
36 |
2
1. overrideIfNonNull : replaced return value with null for fr/sii/ogham/core/builder/configuration/MayOverride::overrideIfNonNull → NO_COVERAGE 2. overrideIfNonNull : replaced return value with null for fr/sii/ogham/core/builder/configuration/MayOverride::overrideIfNonNull → KILLED |
return new NonNullOverride<>(value); |
37 | } | |
38 | ||
39 | /** | |
40 | * Always override current value. | |
41 | * | |
42 | * @param <V> | |
43 | * the type of the value | |
44 | * @param value | |
45 | * the new value to set | |
46 | * @return the override control | |
47 | */ | |
48 | static <V> MayOverride<V> alwaysOverride(V value) { | |
49 |
2
1. alwaysOverride : replaced return value with null for fr/sii/ogham/core/builder/configuration/MayOverride::alwaysOverride → NO_COVERAGE 2. alwaysOverride : replaced return value with null for fr/sii/ogham/core/builder/configuration/MayOverride::alwaysOverride → KILLED |
return new AlwaysOverride<>(value); |
50 | } | |
51 | ||
52 | /** | |
53 | * Override current value only if the current value is not set | |
54 | * ({@code null}). If current value is set, the new value is not applied. | |
55 | * | |
56 | * @param <V> | |
57 | * the type of the value | |
58 | * @param value | |
59 | * the new value to set if current value is {@code null} | |
60 | * @return the override control | |
61 | */ | |
62 | static <V> MayOverride<V> overrideIfNotSet(V value) { | |
63 |
8
1. overrideIfNotSet : replaced return value with null for fr/sii/ogham/core/builder/configuration/MayOverride::overrideIfNotSet → NO_COVERAGE 2. overrideIfNotSet : replaced return value with null for fr/sii/ogham/core/builder/configuration/MayOverride::overrideIfNotSet → KILLED 3. overrideIfNotSet : replaced return value with null for fr/sii/ogham/core/builder/configuration/MayOverride::overrideIfNotSet → KILLED 4. overrideIfNotSet : replaced return value with null for fr/sii/ogham/core/builder/configuration/MayOverride::overrideIfNotSet → KILLED 5. overrideIfNotSet : replaced return value with null for fr/sii/ogham/core/builder/configuration/MayOverride::overrideIfNotSet → KILLED 6. overrideIfNotSet : replaced return value with null for fr/sii/ogham/core/builder/configuration/MayOverride::overrideIfNotSet → KILLED 7. overrideIfNotSet : replaced return value with null for fr/sii/ogham/core/builder/configuration/MayOverride::overrideIfNotSet → KILLED 8. overrideIfNotSet : replaced return value with null for fr/sii/ogham/core/builder/configuration/MayOverride::overrideIfNotSet → KILLED |
return new CurrentValueNotSetOverride<>(value); |
64 | } | |
65 | ||
66 | } | |
Mutations | ||
36 |
1.1 2.2 |
|
49 |
1.1 2.2 |
|
63 |
1.1 2.2 3.3 4.4 5.5 6.6 7.7 8.8 |