aboutsummaryrefslogtreecommitdiffstats
path: root/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/rotation/RotationId.java
blob: 4d97962a40a3f5e05f5dffe85a6c12f14034e827 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.routing.rotation;

import java.util.Objects;

/**
 * ID of a global rotation.
 *
 * @author mpolden
 */
public class RotationId {

    private final String id;

    public RotationId(String id) {
        this.id = id;
    }

    /** Rotation ID, e.g. rotation-42.vespa.global.routing */
    public String asString() {
        return id;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        RotationId that = (RotationId) o;
        return Objects.equals(id, that.id);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id);
    }

    @Override
    public String toString() {
        return "rotation ID " + id;
    }

}