| 1 | package fr.sii.ogham.core.builder.configuration; | |
| 2 | ||
| 3 | /** | |
| 4 | * Override current value only if the new value is not {@code null}. | |
| 5 | * | |
| 6 | * @author Aurélien Baudet | |
| 7 | * | |
| 8 | * @param <V> | |
| 9 | * the type of the value | |
| 10 | */ | |
| 11 | public class NonNullOverride<V> implements MayOverride<V> { | |
| 12 | private final V value; | |
| 13 | ||
| 14 | /** | |
| 15 | * Initializes with the new value to set if the new value is not | |
| 16 | * {@code null}. | |
| 17 | * | |
| 18 | * @param value | |
| 19 | * the new value | |
| 20 | */ | |
| 21 | public NonNullOverride(V value) { | |
| 22 | super(); | |
| 23 | this.value = value; | |
| 24 | } | |
| 25 | ||
| 26 | @Override | |
| 27 | public V override(V currentValue) { | |
| 28 |
4
1. override : negated conditional → NO_COVERAGE 2. override : replaced return value with null for fr/sii/ogham/core/builder/configuration/NonNullOverride::override → NO_COVERAGE 3. override : negated conditional → KILLED 4. override : replaced return value with null for fr/sii/ogham/core/builder/configuration/NonNullOverride::override → KILLED |
return value == null ? currentValue : value; |
| 29 | } | |
| 30 | ||
| 31 | } | |
Mutations | ||
| 28 |
1.1 2.2 3.3 4.4 |