diff options
Diffstat (limited to 'src/main/java/com/keuin/kbackupfabric/operation/backup/feedback/PrimitiveBackupFeedback.java')
-rw-r--r-- | src/main/java/com/keuin/kbackupfabric/operation/backup/feedback/PrimitiveBackupFeedback.java | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/main/java/com/keuin/kbackupfabric/operation/backup/feedback/PrimitiveBackupFeedback.java b/src/main/java/com/keuin/kbackupfabric/operation/backup/feedback/PrimitiveBackupFeedback.java new file mode 100644 index 0000000..6d7a15b --- /dev/null +++ b/src/main/java/com/keuin/kbackupfabric/operation/backup/feedback/PrimitiveBackupFeedback.java @@ -0,0 +1,29 @@ +package com.keuin.kbackupfabric.operation.backup.feedback; + +import static com.keuin.kbackupfabric.util.backup.BackupFilesystemUtil.getFriendlyFileSizeString; + +public class PrimitiveBackupFeedback implements BackupFeedback { + private final boolean success; + private final long backupSizeBytes; + + public PrimitiveBackupFeedback(boolean success, long backupSizeBytes) { + this.success = success; + this.backupSizeBytes = backupSizeBytes; + } + + public boolean isSuccess() { + return success; + } + + public long getBackupSizeBytes() { + return backupSizeBytes; + } + + @Override + public String getFeedback() { + if (success && backupSizeBytes >= 0) + return String.format(" File size: %s.", getFriendlyFileSizeString(backupSizeBytes)); + else + return ""; + } +} |