blob: 68109e2b8d83ca12be1d6c4d472f5279e0db1716 (
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
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.integration.organization;
import java.util.Objects;
/**
* Used to identify issues stored in some issue tracking system.
* The {@code value()} and {@code from()} methods should be inverses.
*
* @author jonmv
*/
public class IssueId {
protected final String id;
protected IssueId(String id) {
this.id = id;
}
public static IssueId from(String value) {
if (value.isEmpty())
throw new IllegalArgumentException("Can not make an IssueId from an empty value.");
return new IssueId(value);
}
public String value() {
return id;
}
@Override
public String toString() {
return value();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
IssueId issueId = (IssueId) o;
return Objects.equals(id, issueId.id);
}
@Override
public int hashCode() {
return Objects.hash(id);
}
}
|