1 | package pro.verron.officestamper.preset.resolvers.localdate; | |
2 | ||
3 | import pro.verron.officestamper.api.StringResolver; | |
4 | ||
5 | import java.time.LocalDate; | |
6 | import java.time.format.DateTimeFormatter; | |
7 | ||
8 | /** | |
9 | * Resolves {@link LocalDate} objects by formatting them with a {@link DateTimeFormatter}. | |
10 | * | |
11 | * @author Joseph Verron | |
12 | * @version ${version} | |
13 | * @since 1.6.4 | |
14 | */ | |
15 | public final class LocalDateResolver | |
16 | extends StringResolver<LocalDate> { | |
17 | private final DateTimeFormatter formatter; | |
18 | ||
19 | /** | |
20 | * Uses {@link DateTimeFormatter#ISO_LOCAL_DATE} for formatting. | |
21 | */ | |
22 | public LocalDateResolver() { | |
23 | this(DateTimeFormatter.ISO_LOCAL_DATE); | |
24 | } | |
25 | ||
26 | /** | |
27 | * Uses the given formatter for formatting. | |
28 | * | |
29 | * @param formatter the formatter to use. | |
30 | */ | |
31 | public LocalDateResolver(DateTimeFormatter formatter) { | |
32 | super(LocalDate.class); | |
33 | this.formatter = formatter; | |
34 | } | |
35 | ||
36 | /** {@inheritDoc} */ | |
37 | @Override | |
38 | protected String resolve(LocalDate localDateTime) { | |
39 |
1
1. resolve : replaced return value with "" for pro/verron/officestamper/preset/resolvers/localdate/LocalDateResolver::resolve → KILLED |
return localDateTime.format(formatter); |
40 | } | |
41 | } | |
Mutations | ||
39 |
1.1 |