From 08ac6aaea58b7309ea95a12ca6227a6ca3ce4db5 Mon Sep 17 00:00:00 2001 From: Keuin Date: Mon, 25 Jan 2021 15:25:34 +0800 Subject: Improve user interaction. Code refactor. --- .../com/keuin/kbackupfabric/ui/BackupInfo.java | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/main/java/com/keuin/kbackupfabric/ui/BackupInfo.java (limited to 'src/main/java/com/keuin/kbackupfabric/ui/BackupInfo.java') diff --git a/src/main/java/com/keuin/kbackupfabric/ui/BackupInfo.java b/src/main/java/com/keuin/kbackupfabric/ui/BackupInfo.java new file mode 100644 index 0000000..cf537f9 --- /dev/null +++ b/src/main/java/com/keuin/kbackupfabric/ui/BackupInfo.java @@ -0,0 +1,34 @@ +package com.keuin.kbackupfabric.ui; + +import com.keuin.kbackupfabric.operation.backup.method.ConfiguredBackupMethod; +import com.keuin.kbackupfabric.util.DateUtil; +import net.minecraft.server.MinecraftServer; + +import java.time.LocalDateTime; + +/** + * Used in UI part. Holds necessary information for displaying a backup. + */ +public interface BackupInfo { + String getName(); + + LocalDateTime getCreationTime(); + + long getSizeBytes(); + + String getType(); + + default String getCanonicalName() { + return getName() + "-" + DateUtil.getString(getCreationTime()); + } + + ConfiguredBackupMethod createConfiguredBackupMethod(MinecraftServer server); + + /** + * This is depreciated. But eliminating all usages needs to refactor the UI code. + * + * @return the backup file name. + */ + @Deprecated + String getBackupFileName(); +} \ No newline at end of file -- cgit v1.2.3