Skip to content

Commit ac0a930

Browse files
authored
Added methods (#978)
Signed-off-by: dhoard <doug.hoard@gmail.com>
1 parent d567081 commit ac0a930

File tree

1 file changed

+24
-0
lines changed
  • prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/snapshots

1 file changed

+24
-0
lines changed

prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/snapshots/Label.java

+24
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package io.prometheus.metrics.model.snapshots;
22

3+
import java.util.Objects;
4+
35
/**
46
* Utility for iterating over {@link Labels}.
57
*/
@@ -16,6 +18,7 @@ public Label(String name, String value) {
1618
public String getName() {
1719
return name;
1820
}
21+
1922
public String getValue() {
2023
return value;
2124
}
@@ -25,4 +28,25 @@ public int compareTo(Label other) {
2528
int nameCompare = name.compareTo(other.name);
2629
return nameCompare != 0 ? nameCompare : value.compareTo(other.value);
2730
}
31+
32+
@Override
33+
public String toString() {
34+
return "Label{" +
35+
"name='" + name + '\'' +
36+
", value='" + value + '\'' +
37+
'}';
38+
}
39+
40+
@Override
41+
public boolean equals(Object o) {
42+
if (this == o) return true;
43+
if (o == null || getClass() != o.getClass()) return false;
44+
Label label = (Label) o;
45+
return Objects.equals(name, label.name) && Objects.equals(value, label.value);
46+
}
47+
48+
@Override
49+
public int hashCode() {
50+
return Objects.hash(name, value);
51+
}
2852
}

0 commit comments

Comments
 (0)