summaryrefslogtreecommitdiff
path: root/src/main/java/com/keuin/kbackupfabric/util/backup/name/BackupFileNameEncoder.java
diff options
context:
space:
mode:
authorKeuin <[email protected]>2021-01-13 13:22:19 +0800
committerkeuin <[email protected]>2021-01-13 13:22:19 +0800
commitc82e1ee286e89f6e36e8920282d348ce8cfae9cf (patch)
tree63e9828aacc7cd691655dffc2c2f046d0c4dd807 /src/main/java/com/keuin/kbackupfabric/util/backup/name/BackupFileNameEncoder.java
parent81497ebee2cdb0dac3bcdc26c5d77d06bdb98b5d (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.java9
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));
+ }
}
}