summaryrefslogtreecommitdiff
path: root/runtime/src/main/java/eu/mulk/quarkus/googlecloud/jsonlogging/Label.java
blob: 7c5d14de3e0bb77a90264d66a6da550c77a6cb9c (plain)
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
package eu.mulk.quarkus.googlecloud.jsonlogging;

import java.util.Objects;

public final class Label {

  private final String key;
  private final String value;

  private Label(String key, String value) {
    this.key = key;
    this.value = value;
  }

  public static Label of(String key, String value) {
    return new Label(key, value);
  }

  public String key() {
    return key;
  }

  public String value() {
    return value;
  }

  @Override
  public boolean equals(Object obj) {
    if (obj == this) return true;
    if (obj == null || obj.getClass() != this.getClass()) return false;
    var that = (Label) obj;
    return Objects.equals(this.key, that.key) && Objects.equals(this.value, that.value);
  }

  @Override
  public int hashCode() {
    return Objects.hash(key, value);
  }

  @Override
  public String toString() {
    return "Label[" + "key=" + key + ", " + "value=" + value + ']';
  }
}