summaryrefslogtreecommitdiff
path: root/src/main/java/com/keuin/kbackupfabric/util/backup/incremental/ObjectCollection.java
diff options
context:
space:
mode:
authorKeuin <[email protected]>2021-01-20 19:50:42 +0800
committerkeuin <[email protected]>2021-01-20 19:50:42 +0800
commitac7e70883c18602e7fd4b525b9e6fb9ea9620a6b (patch)
tree63b2d65d2fe489ef0cc1fe6e9a87b65c0b69de84 /src/main/java/com/keuin/kbackupfabric/util/backup/incremental/ObjectCollection.java
parent7a5297de3467b1069fdf5e4a1b2aaf510ca35663 (diff)
refactor
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.java65
1 files changed, 0 insertions, 65 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
deleted file mode 100644
index 16d95e6..0000000
--- a/src/main/java/com/keuin/kbackupfabric/util/backup/incremental/ObjectCollection.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package com.keuin.kbackupfabric.util.backup.incremental;
-
-import java.io.Serializable;
-import java.util.*;
-
-public class ObjectCollection implements Serializable {
- private final String name;
- private final Map<String, ObjectElement> elements;
- private final Map<String, ObjectCollection> subCollections;
-
- ObjectCollection(String name, Set<ObjectElement> elements, Map<String, ObjectCollection> subCollections) {
- this.name = Objects.requireNonNull(name);
- this.elements = new HashMap<>();
- for (ObjectElement e : elements) {
- Objects.requireNonNull(e);
- if (this.elements.put(e.getName(), e) != null) {
- throw new IllegalStateException("elements conflict with the same name");
- }
- }
- this.subCollections = new HashMap<>(Objects.requireNonNull(subCollections));
- }
-
- public String getName() {
- return name;
- }
-
- public Set<ObjectElement> getElementSet() {
- return new HashSet<>(elements.values());
- }
-
- public Map<String, ObjectElement> getElementMap() {
- return Collections.unmodifiableMap(elements);
- }
-
- public ObjectElement getElement(String name) {
- return elements.get(name);
- }
-
- public Set<ObjectCollection> getSubCollectionSet() {
- return new HashSet<>(subCollections.values());
- }
-
- public Map<String, ObjectCollection> getSubCollectionMap() {
- return Collections.unmodifiableMap(subCollections);
- }
-
- public ObjectCollection getSubCollection(String name) {
- return subCollections.get(name);
- }
-
- @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);
- }
-}