diff --git a/context/src/main/java/io/micronaut/runtime/converters/time/TimeConverterRegistrar.java b/context/src/main/java/io/micronaut/runtime/converters/time/TimeConverterRegistrar.java index f9383877460..b2039f37c7c 100644 --- a/context/src/main/java/io/micronaut/runtime/converters/time/TimeConverterRegistrar.java +++ b/context/src/main/java/io/micronaut/runtime/converters/time/TimeConverterRegistrar.java @@ -24,7 +24,19 @@ import io.micronaut.core.convert.format.Format; import io.micronaut.core.util.StringUtils; -import java.time.*; +import java.time.Duration; +import java.time.Instant; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.MonthDay; +import java.time.OffsetDateTime; +import java.time.OffsetTime; +import java.time.Period; +import java.time.Year; +import java.time.YearMonth; +import java.time.ZoneId; +import java.time.ZoneOffset; +import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; import java.time.format.DateTimeParseException; import java.time.temporal.TemporalAccessor; @@ -129,9 +141,9 @@ public void register(ConversionService conversionService) { // CharSequence -> TemporalAmount conversionService.addConverter( - CharSequence.class, - TemporalAmount.class, - (object, targetType, context) -> durationConverter.apply(object, context).map(TemporalAmount.class::cast) + CharSequence.class, + TemporalAmount.class, + (object, targetType, context) -> durationConverter.apply(object, context).map(TemporalAmount.class::cast) ); // TemporalAccessor -> CharSequence @@ -166,9 +178,9 @@ public void register(ConversionService conversionService) { } }; conversionService.addConverter( - LocalDateTime.class, - CharSequence.class, - localDateTimeConverter + LocalDateTime.class, + CharSequence.class, + localDateTimeConverter ); addTemporalStringConverter(conversionService, Instant.class, DateTimeFormatter.ISO_INSTANT, Instant::from); @@ -229,7 +241,7 @@ private void addTemporalToDateConverter(ConversionS private DateTimeFormatter resolveFormatter(ConversionContext context) { Optional format = context.getAnnotationMetadata().stringValue(Format.class); return format - .map(pattern -> DateTimeFormatter.ofPattern(pattern, context.getLocale())) - .orElse(DateTimeFormatter.RFC_1123_DATE_TIME); + .map(pattern -> DateTimeFormatter.ofPattern(pattern, context.getLocale())) + .orElse(DateTimeFormatter.RFC_1123_DATE_TIME); } }