diff options
author | Keuin <[email protected]> | 2021-01-12 12:51:23 +0800 |
---|---|---|
committer | keuin <[email protected]> | 2021-01-12 12:51:23 +0800 |
commit | afd26cdd12fef4bd2aafa2ac8d708e18d277a2fe (patch) | |
tree | e389ccbe9fb48e03de25b38d3ef7d5c273c5ec97 /src/main/java/com/keuin/kbackupfabric/util/backup/incremental/ObjectCollection.java | |
parent | 8b05c48d76bbb05c2b440e57df1d9b3323edc598 (diff) |
Implement object collection(not tested) and sha256(tested)
Diffstat (limited to 'src/main/java/com/keuin/kbackupfabric/util/backup/incremental/ObjectCollection.java')
-rw-r--r-- | src/main/java/com/keuin/kbackupfabric/util/backup/incremental/ObjectCollection.java | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/main/java/com/keuin/kbackupfabric/util/backup/incremental/ObjectCollection.java b/src/main/java/com/keuin/kbackupfabric/util/backup/incremental/ObjectCollection.java new file mode 100644 index 0000000..d5d766a --- /dev/null +++ b/src/main/java/com/keuin/kbackupfabric/util/backup/incremental/ObjectCollection.java @@ -0,0 +1,45 @@ +package com.keuin.kbackupfabric.util.backup.incremental; + +import com.keuin.kbackupfabric.util.backup.incremental.identifier.ObjectIdentifier; + +import java.util.Objects; +import java.util.Set; + +public class ObjectCollection { + private final String name; + private final Set<ObjectIdentifier> elements; + private final Set<ObjectCollection> subCollections; + + ObjectCollection(String name, Set<ObjectIdentifier> elements, Set<ObjectCollection> subCollections) { + this.name = Objects.requireNonNull(name); + this.elements = Objects.requireNonNull(elements); + this.subCollections = Objects.requireNonNull(subCollections); + } + + public String getName() { + return name; + } + + public Set<ObjectIdentifier> getElements() { + return elements; + } + + public Set<ObjectCollection> getSubCollections() { + return subCollections; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + ObjectCollection that = (ObjectCollection) o; + return name.equals(that.name) && + elements.equals(that.elements) && + subCollections.equals(that.subCollections); + } + + @Override + public int hashCode() { + return Objects.hash(name, elements, subCollections); + } +} |