1 | package pro.verron.officestamper.preset.resolvers.nulls; | |
2 | ||
3 | import org.docx4j.wml.R; | |
4 | import org.springframework.lang.Nullable; | |
5 | import pro.verron.officestamper.api.DocxPart; | |
6 | import pro.verron.officestamper.api.ObjectResolver; | |
7 | ||
8 | import static pro.verron.officestamper.utils.WmlFactory.newRun; | |
9 | ||
10 | /// The Null2DefaultResolver class is an implementation of the | |
11 | /// [ObjectResolver] interface | |
12 | /// that resolves null objects by creating a run with a default text value. | |
13 | /// | |
14 | /// @author Joseph Verron | |
15 | /// @version ${version} | |
16 | /// @since 1.6.7 | |
17 | public record Null2DefaultResolver(String text) | |
18 | implements ObjectResolver { | |
19 | ||
20 | @Override | |
21 | public boolean canResolve(@Nullable Object object) { | |
22 |
2
1. canResolve : negated conditional → KILLED 2. canResolve : replaced boolean return with true for pro/verron/officestamper/preset/resolvers/nulls/Null2DefaultResolver::canResolve → KILLED |
return object == null; |
23 | } | |
24 | ||
25 | @Override | |
26 | public R resolve( | |
27 | DocxPart document, | |
28 | String expression, | |
29 | Object object | |
30 | ) { | |
31 |
1
1. resolve : replaced return value with null for pro/verron/officestamper/preset/resolvers/nulls/Null2DefaultResolver::resolve → KILLED |
return newRun(text); |
32 | } | |
33 | ||
34 | /// Retrieves the default value of the [Null2DefaultResolver] object. | |
35 | /// | |
36 | /// @return the default value of the [Null2DefaultResolver] object as a String | |
37 | public String defaultValue() { | |
38 |
1
1. defaultValue : replaced return value with "" for pro/verron/officestamper/preset/resolvers/nulls/Null2DefaultResolver::defaultValue → NO_COVERAGE |
return text; |
39 | } | |
40 | } | |
Mutations | ||
22 |
1.1 2.2 |
|
31 |
1.1 |
|
38 |
1.1 |