summaryrefslogtreecommitdiff
path: root/src/main/java/com/keuin/kbackupfabric/util/backup/incremental/ObjectCollection.java
blob: d5d766abc1c0877ab8f8e181a8f5fd7daddbd049 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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);
    }
}