diff options
author | Keuin <[email protected]> | 2021-01-13 13:22:19 +0800 |
---|---|---|
committer | keuin <[email protected]> | 2021-01-13 13:22:19 +0800 |
commit | c82e1ee286e89f6e36e8920282d348ce8cfae9cf (patch) | |
tree | 63e9828aacc7cd691655dffc2c2f046d0c4dd807 /src/main/java/com/keuin/kbackupfabric/util/backup/name/BackupFileNameEncoder.java | |
parent | 81497ebee2cdb0dac3bcdc26c5d77d06bdb98b5d (diff) |
Refactor for a better code quality
Diffstat (limited to 'src/main/java/com/keuin/kbackupfabric/util/backup/name/BackupFileNameEncoder.java')
-rw-r--r-- | src/main/java/com/keuin/kbackupfabric/util/backup/name/BackupFileNameEncoder.java | 9 |
1 files changed, 9 insertions, 0 deletions
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)); + } } } |