From 4a1d885afa7217b47d6183488c3dc6537cef05b6 Mon Sep 17 00:00:00 2001 From: Keuin Date: Sat, 23 Jan 2021 14:10:32 +0800 Subject: Version 1.4.6 (preview): added metadata for incremental backup (need integrated test and display implementation) --- .../backup/incremental/ObjectElementConverter.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/main/java/com/keuin/kbackupfabric/backup/incremental/ObjectElementConverter.java (limited to 'src/main/java/com/keuin/kbackupfabric/backup/incremental/ObjectElementConverter.java') diff --git a/src/main/java/com/keuin/kbackupfabric/backup/incremental/ObjectElementConverter.java b/src/main/java/com/keuin/kbackupfabric/backup/incremental/ObjectElementConverter.java new file mode 100644 index 0000000..512c2d2 --- /dev/null +++ b/src/main/java/com/keuin/kbackupfabric/backup/incremental/ObjectElementConverter.java @@ -0,0 +1,18 @@ +package com.keuin.kbackupfabric.backup.incremental; + +import com.keuin.kbackupfabric.backup.incremental.identifier.Sha256IdentifierConverter; +import com.keuin.kbackupfabric.util.backup.incremental.identifier.Sha256Identifier; + +public class ObjectElementConverter { + public static ObjectElement convert(com.keuin.kbackupfabric.util.backup.incremental.ObjectElement oldObjectElement) { + try { + return new ObjectElement( + oldObjectElement.getName(), + // in real world case, Sha256Identifier is the only used identifier in KBackup. So the cast is surely safe + Sha256IdentifierConverter.convert((Sha256Identifier) oldObjectElement.getIdentifier()) + ); + } catch (IllegalAccessException | NoSuchFieldException e) { + throw new RuntimeException(e); + } + } +} -- cgit v1.2.3