aboutsummaryrefslogtreecommitdiffstats
path: root/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/versions/CertifiedOsVersion.java
blob: 0a790be1ab818e2a6eae9df8bcc5c87af11caf1f (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.versions;

import com.yahoo.component.Version;

import java.util.Comparator;
import java.util.Objects;

/**
 * An OS version that has been certified to work on a specific Vespa version.
 *
 * @author mpolden
 */
public record CertifiedOsVersion(OsVersion osVersion, Version vespaVersion) implements Comparable<CertifiedOsVersion> {

    private static final Comparator<CertifiedOsVersion> comparator = Comparator.comparing(CertifiedOsVersion::osVersion)
                                                                               .thenComparing(CertifiedOsVersion::vespaVersion);

    public CertifiedOsVersion {
        Objects.requireNonNull(osVersion);
        Objects.requireNonNull(vespaVersion);
    }

    @Override
    public int compareTo(CertifiedOsVersion that) {
        return comparator.compare(this, that);
    }

}