From c82e1ee286e89f6e36e8920282d348ce8cfae9cf Mon Sep 17 00:00:00 2001 From: Keuin Date: Wed, 13 Jan 2021 13:22:19 +0800 Subject: Refactor for a better code quality --- .../kbackupfabric/util/backup/name/BackupFileNameEncoder.java | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/main/java/com/keuin/kbackupfabric/util/backup/name/BackupFileNameEncoder.java') diff --git a/src/main/java/com/keuin/kbackupfabric/util/backup/name/BackupFileNameEncoder.java b/src/main/java/com/keuin/kbackupfabric/util/backup/name/BackupFileNameEncoder.java index 83967b7..972403b 100644 --- a/src/main/java/com/keuin/kbackupfabric/util/backup/name/BackupFileNameEncoder.java +++ b/src/main/java/com/keuin/kbackupfabric/util/backup/name/BackupFileNameEncoder.java @@ -1,6 +1,7 @@ package com.keuin.kbackupfabric.util.backup.name; import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; /** * Encode and decode backup file name for a specific backup type. @@ -38,12 +39,20 @@ public interface BackupFileNameEncoder { } class BackupBasicInformation { + public final String customName; public final LocalDateTime time; + private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm.ss"); + BackupBasicInformation(String customName, LocalDateTime time) { this.customName = customName; this.time = time; } + + @Override + public String toString() { + return String.format("%s, %s", customName, time.format(formatter)); + } } } -- cgit v1.2.3