| 1 | package pro.verron.officestamper.preset.resolvers.nulls; | |
| 2 | ||
| 3 | import org.jspecify.annotations.Nullable; | |
| 4 | import pro.verron.officestamper.api.DocxPart; | |
| 5 | import pro.verron.officestamper.api.Insert; | |
| 6 | import pro.verron.officestamper.api.ObjectResolver; | |
| 7 | ||
| 8 | import static pro.verron.officestamper.utils.wml.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 defaultValue) | |
| 18 | implements ObjectResolver { | |
| 19 | ||
| 20 | @Override | |
| 21 | public Insert resolve(DocxPart part, String expression, @Nullable Object object) { | |
| 22 |
1
1. resolve : replaced return value with null for pro/verron/officestamper/preset/resolvers/nulls/Null2DefaultResolver::resolve → TIMED_OUT |
return new Insert(newRun(defaultValue)); |
| 23 | } | |
| 24 | ||
| 25 | @Override | |
| 26 | public boolean canResolve(@Nullable Object object) { | |
| 27 |
2
1. canResolve : negated conditional → TIMED_OUT 2. canResolve : replaced boolean return with true for pro/verron/officestamper/preset/resolvers/nulls/Null2DefaultResolver::canResolve → TIMED_OUT |
return object == null; |
| 28 | } | |
| 29 | } | |
Mutations | ||
| 22 |
1.1 |
|
| 27 |
1.1 2.2 |