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