blob: 7c5d14de3e0bb77a90264d66a6da550c77a6cb9c [file] [log] [blame]
Matthias Andreas Benkardb8fbc372021-05-11 06:50:45 +02001package eu.mulk.quarkus.googlecloud.jsonlogging;
2
Matthias Andreas Benkard121a6312021-05-12 05:41:25 +02003import java.util.Objects;
4
5public final class Label {
6
7 private final String key;
8 private final String value;
9
10 private Label(String key, String value) {
11 this.key = key;
12 this.value = value;
13 }
Matthias Andreas Benkardb8fbc372021-05-11 06:50:45 +020014
15 public static Label of(String key, String value) {
16 return new Label(key, value);
17 }
Matthias Andreas Benkard121a6312021-05-12 05:41:25 +020018
19 public String key() {
20 return key;
21 }
22
23 public String value() {
24 return value;
25 }
26
27 @Override
28 public boolean equals(Object obj) {
29 if (obj == this) return true;
30 if (obj == null || obj.getClass() != this.getClass()) return false;
31 var that = (Label) obj;
32 return Objects.equals(this.key, that.key) && Objects.equals(this.value, that.value);
33 }
34
35 @Override
36 public int hashCode() {
37 return Objects.hash(key, value);
38 }
39
40 @Override
41 public String toString() {
42 return "Label[" + "key=" + key + ", " + "value=" + value + ']';
43 }
Matthias Andreas Benkardb8fbc372021-05-11 06:50:45 +020044}