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