Commit ac0a930 1 parent d567081 commit ac0a930 Copy full SHA for 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 Original file line number Diff line number Diff line change 1
1
package io .prometheus .metrics .model .snapshots ;
2
2
3
+ import java .util .Objects ;
4
+
3
5
/**
4
6
* Utility for iterating over {@link Labels}.
5
7
*/
@@ -16,6 +18,7 @@ public Label(String name, String value) {
16
18
public String getName () {
17
19
return name ;
18
20
}
21
+
19
22
public String getValue () {
20
23
return value ;
21
24
}
@@ -25,4 +28,25 @@ public int compareTo(Label other) {
25
28
int nameCompare = name .compareTo (other .name );
26
29
return nameCompare != 0 ? nameCompare : value .compareTo (other .value );
27
30
}
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
+ }
28
52
}
You can’t perform that action at this time.
0 commit comments