summaryrefslogtreecommitdiffstats
path: root/docker-api/src/main/java/com/yahoo/vespa/hosted/dockerapi/DockerImage.java
blob: 033e227c7bf0a92cd8bb2a2eea1799bb8e280c84 (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
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.dockerapi;

import java.util.Objects;

/**
 * Type-safe value wrapper for docker image reference.
 *
 * @author bakksjo
 */
public class DockerImage {
    private final String imageId;

    public DockerImage(final String imageId) {
        this.imageId = Objects.requireNonNull(imageId);
    }

    public String asString() {
        return imageId;
    }

    @Override
    public int hashCode() {
        return imageId.hashCode();
    }

    @Override
    public boolean equals(final Object o) {
        if (!(o instanceof DockerImage)) {
            return false;
        }

        final DockerImage other = (DockerImage) o;

        return Objects.equals(imageId, other.imageId);
    }

    @Override
    public String toString() {
        return getClass().getSimpleName() + " {"
                + " imageId=" + imageId
                + " }";
    }
}