aboutsummaryrefslogtreecommitdiffstats
path: root/application-model/src/main/java/com/yahoo/vespa/applicationmodel/ServiceInstance.java
blob: 2b31bb11ff7148191860c78e1be1635dacfbab4d (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
53
54
55
56
57
58
59
60
61
62
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.applicationmodel;

import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.Objects;

/**
 * @author bjorncs
 */
public class ServiceInstance {

    private final ConfigId configId;
    private final HostName hostName;
    private final ServiceStatus serviceStatus;

    public ServiceInstance(ConfigId configId, HostName hostName, ServiceStatus serviceStatus) {
        this.configId = configId;
        this.hostName = hostName;
        this.serviceStatus = serviceStatus;
    }

    @JsonProperty("configId")
    public ConfigId configId() {
        return configId;
    }

    @JsonProperty("hostName")
    public HostName hostName() {
        return hostName;
    }

    @JsonProperty("serviceStatus")
    public ServiceStatus serviceStatus() {
        return serviceStatus;
    }

    @Override
    public String toString() {
        return "ServiceInstance{" +
                "configId=" + configId +
                ", hostName=" + hostName +
                ", serviceStatus=" + serviceStatus +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        ServiceInstance that = (ServiceInstance) o;
        return Objects.equals(configId, that.configId) &&
                Objects.equals(hostName, that.hostName) &&
                Objects.equals(serviceStatus, that.serviceStatus);
    }

    @Override
    public int hashCode() {
        return Objects.hash(configId, hostName, serviceStatus);
    }

}