File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
prometheus-metrics-model/src/main/java/io/prometheus/metrics/model/snapshots Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 11package 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}
You can’t perform that action at this time.
0 commit comments