Skip to content

Commit 08a947a

Browse files
Merge pull request #344 from saskiawagenaar/master
Implemented equals method for Quantity
2 parents 3805477 + 1d46c93 commit 08a947a

File tree

1 file changed

+18
-0
lines changed
  • kubernetes/src/main/java/io/kubernetes/client/custom

1 file changed

+18
-0
lines changed

kubernetes/src/main/java/io/kubernetes/client/custom/Quantity.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
import java.io.IOException;
99
import java.math.BigDecimal;
10+
import java.util.Objects;
11+
12+
import org.apache.commons.lang3.ObjectUtils;
1013

1114
@JsonAdapter(Quantity.QuantityAdapter.class)
1215
public class Quantity {
@@ -62,6 +65,21 @@ public String toString() {
6265
'}';
6366
}
6467

68+
@Override
69+
public boolean equals(Object o) {
70+
if (this == o) {
71+
return true;
72+
}
73+
if (o == null || getClass() != o.getClass()) {
74+
return false;
75+
}
76+
77+
Quantity otherQuantity = (Quantity) o;
78+
79+
return ObjectUtils.compare(this.number, otherQuantity.number) == 0 &&
80+
Objects.equals(this.format, otherQuantity.format);
81+
}
82+
6583
public class QuantityAdapter extends TypeAdapter<Quantity> {
6684
@Override
6785
public void write(JsonWriter jsonWriter, Quantity quantity) throws IOException {

0 commit comments

Comments
 (0)