blob: dc334085a4cebe7d5dda32cb6286291f27bfd324 (
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
|
package com.yahoo.vespa.applicationmodel;
import com.fasterxml.jackson.annotation.JsonValue;
import java.util.Objects;
/**
* @author bjorncs
*/
public class HostName {
public final String id;
public HostName(String id) {
this.id = id;
}
// Jackson's StdKeySerializer uses toString() (and ignores annotations) for objects used as Map keys.
// Therefore, we use toString() as the JSON-producing method, which is really sad.
@JsonValue
@Override
public String toString() {
return super.toString();
}
// For compatibility with original Scala case class
public String s() {
return id;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
HostName hostName = (HostName) o;
return Objects.equals(id, hostName.id);
}
@Override
public int hashCode() {
return Objects.hash(id);
}
}
|