aboutsummaryrefslogtreecommitdiffstats
path: root/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/editor/Mark.java
blob: 9c6871010c8352ae71cb34c8edf1d6d767a0116e (plain) (blame)
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
46
47
48
49
50
51
52
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

package com.yahoo.vespa.hosted.node.admin.task.util.editor;

import java.util.Objects;

/**
 * @author hakon
 */
public class Mark {
    private final Position position;
    private final Version version;
    private final Object token;

    Mark(Position position, Version version, Object token) {
        this.position = position;
        this.version = version;
        this.token = token;
    }

    public Position position() {
        return position;
    }

    public Version version() {
        return version;
    }

    public Object secret() {
        return token;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Mark mark = (Mark) o;
        return Objects.equals(position, mark.position) &&
                Objects.equals(version, mark.version) &&
                token == mark.token;
    }

    @Override
    public int hashCode() {
        return Objects.hash(position, version, token);
    }

    @Override
    public String toString() {
        return position.coordinateString() + "@" + version;
    }
}