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