From 5063ab12c48a6612d903c44c943230b6c323f602 Mon Sep 17 00:00:00 2001 From: Keuin Date: Sun, 24 Jan 2021 20:01:17 +0800 Subject: Code refactor: eliminate unnecessary instance creation of IncrementalBackupFileNameEncoder --- .../com/keuin/kbackupfabric/backup/name/BackupFileNameEncoder.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/main/java/com/keuin/kbackupfabric/backup/name/BackupFileNameEncoder.java') diff --git a/src/main/java/com/keuin/kbackupfabric/backup/name/BackupFileNameEncoder.java b/src/main/java/com/keuin/kbackupfabric/backup/name/BackupFileNameEncoder.java index 8ad91f7..b471834 100644 --- a/src/main/java/com/keuin/kbackupfabric/backup/name/BackupFileNameEncoder.java +++ b/src/main/java/com/keuin/kbackupfabric/backup/name/BackupFileNameEncoder.java @@ -1,7 +1,8 @@ package com.keuin.kbackupfabric.backup.name; +import com.keuin.kbackupfabric.util.DateUtil; + import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; /** * Encode and decode backup file name for a specific backup type. @@ -49,8 +50,6 @@ public interface BackupFileNameEncoder { public final String customName; public final LocalDateTime time; - private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm.ss"); - protected BackupBasicInformation(String customName, LocalDateTime time) { this.customName = customName; this.time = time; @@ -58,7 +57,7 @@ public interface BackupFileNameEncoder { @Override public String toString() { - return String.format("%s, %s", customName, time.format(formatter)); + return String.format("%s, %s", customName, DateUtil.getString(time)); } } } -- cgit v1.2.3