MayOverride.java

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 1 1. overrideIfNonNull : replaced return value with null for fr/sii/ogham/core/builder/configuration/MayOverride::overrideIfNonNull → RUN_ERROR
		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 1 1. alwaysOverride : replaced return value with null for fr/sii/ogham/core/builder/configuration/MayOverride::alwaysOverride → RUN_ERROR
		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 1 1. overrideIfNotSet : replaced return value with null for fr/sii/ogham/core/builder/configuration/MayOverride::overrideIfNotSet → RUN_ERROR
		return new CurrentValueNotSetOverride<>(value);
64
	}
65
66
}

Mutations

36

1.1
Location : overrideIfNonNull
Killed by :
replaced return value with null for fr/sii/ogham/core/builder/configuration/MayOverride::overrideIfNonNull → RUN_ERROR

49

1.1
Location : alwaysOverride
Killed by :
replaced return value with null for fr/sii/ogham/core/builder/configuration/MayOverride::alwaysOverride → RUN_ERROR

63

1.1
Location : overrideIfNotSet
Killed by :
replaced return value with null for fr/sii/ogham/core/builder/configuration/MayOverride::overrideIfNotSet → RUN_ERROR

Active mutators

Tests examined


Report generated by PIT 1.13.1