aboutsummaryrefslogtreecommitdiffstats
path: root/config-model-api/src/main/java/com/yahoo/config/model/api/PortInfo.java
blob: 045c421e8974baaa5e35596a4f6b9bdad5a48773 (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.config.model.api;

import java.util.Collection;

/**
 * Contains information about a port (port number and a collection of tags).
 *
 */
public class PortInfo {
    private final int port;
    private final Collection<String> tags;

    public PortInfo(int port, Collection<String> tags) {
        this.port = port;
        this.tags = tags;
    }

    public int getPort() {
        return port;
    }

    public Collection<String> getTags() {
        return tags;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        PortInfo portInfo = (PortInfo) o;

        if (port != portInfo.port) return false;
        if (tags != null ? !tags.equals(portInfo.tags) : portInfo.tags != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = port;
        result = 31 * result + (tags != null ? tags.hashCode() : 0);
        return result;
    }
}