summaryrefslogtreecommitdiff
path: root/src/main/java/com/keuin/kbackupfabric/util/backup/builder/PrimitiveZipBackupFileNameBuilder.java
blob: 6d8b5f505229168527c7e56dfdac3aae9f28b6b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package com.keuin.kbackupfabric.util.backup.builder;

import com.keuin.kbackupfabric.util.backup.BackupFilesystemUtil;
import com.keuin.kbackupfabric.util.backup.BackupNameTimeFormatter;

import java.time.LocalDateTime;

public class PrimitiveZipBackupFileNameBuilder implements BackupFileNameBuilder {

    private static final PrimitiveZipBackupFileNameBuilder instance = new PrimitiveZipBackupFileNameBuilder();

    public static PrimitiveZipBackupFileNameBuilder getInstance() {
        return instance;
    }

    @Override
    public String build(LocalDateTime time, String backupName) {
        String timeString = BackupNameTimeFormatter.localDateTimeToString(time);
        return String.format("%s%s_%s%s", BackupFilesystemUtil.getBackupFileNamePrefix(), timeString, backupName, ".zip");
    }

}