diff --git a/webcal/src/main/java/com/onixbyte/webcal/config/DateAndTimeFormatter.java b/webcal/src/main/java/com/onixbyte/webcal/config/Formatters.java similarity index 90% rename from webcal/src/main/java/com/onixbyte/webcal/config/DateAndTimeFormatter.java rename to webcal/src/main/java/com/onixbyte/webcal/config/Formatters.java index 57b0eb8..89c1d31 100644 --- a/webcal/src/main/java/com/onixbyte/webcal/config/DateAndTimeFormatter.java +++ b/webcal/src/main/java/com/onixbyte/webcal/config/Formatters.java @@ -26,7 +26,7 @@ import java.util.Objects; * * @author Zihlu Wang */ -public final class DateAndTimeFormatter { +public final class Formatters { /** * Get the {@link java.time.format.DateTimeFormatter datetime formatter} @@ -45,4 +45,10 @@ public final class DateAndTimeFormatter { private static DateTimeFormatter utcDateTimeFormatter; + /** + * Private constructor to prevent this class being initialised. + */ + private Formatters() { + } + } diff --git a/webcal/src/main/java/com/onixbyte/webcal/impl/WebCalendarEvent.java b/webcal/src/main/java/com/onixbyte/webcal/impl/WebCalendarEvent.java index 07b64f1..de26f5e 100644 --- a/webcal/src/main/java/com/onixbyte/webcal/impl/WebCalendarEvent.java +++ b/webcal/src/main/java/com/onixbyte/webcal/impl/WebCalendarEvent.java @@ -19,7 +19,7 @@ package com.onixbyte.webcal.impl; import com.onixbyte.webcal.WebCalendarNode; import com.onixbyte.webcal.config.Classification; -import com.onixbyte.webcal.config.DateAndTimeFormatter; +import com.onixbyte.webcal.config.Formatters; import java.text.MessageFormat; import java.time.Duration; @@ -269,8 +269,8 @@ public final class WebCalendarEvent extends WebCalendarNode { END:{0}""", /* 0 - tag */TAG, /* 1 - uid */ Optional.ofNullable(uid).orElse(UUID.randomUUID().toString()) + "@" + domainName, - /* 2 - dtstamp */ now.format(DateAndTimeFormatter.getUtcDatetimeFormatter()), - /* 3 - start time */ start.atZone(ZoneId.systemDefault()).format(DateAndTimeFormatter.getUtcDatetimeFormatter()), + /* 2 - dtstamp */ now.format(Formatters.getUtcDatetimeFormatter()), + /* 3 - start time */ start.atZone(ZoneId.systemDefault()).format(Formatters.getUtcDatetimeFormatter()), /* 4 - summary */ Optional.ofNullable(summary).map((item) -> "\nSUMMARY:" + item).orElse(""), /* 5 - categories */ Optional.ofNullable(categories) .map((item) -> !item.isEmpty() ? "\nCATEGORIES:" + resolveCategories() : null).orElse(""),