Skip to content
This repository was archived by the owner on May 14, 2026. It is now read-only.

Commit c047b4c

Browse files
authored
[ggj][engx] fix: add equals() and hashCode() for MethodArgument (#623)
* fix: fix dep ordering in Bazel dedupe rules * feat: add a basic trie * fix: add hashCode() and equals() to Field * fix: add equals() and hashCode() for MethodArgument
1 parent 4fc83dd commit c047b4c

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

src/main/java/com/google/api/generator/gapic/model/MethodArgument.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,28 @@ public int compareTo(MethodArgument other) {
4646
return compareVal;
4747
}
4848

49+
@Override
50+
public boolean equals(Object o) {
51+
if (!(o instanceof MethodArgument)) {
52+
return false;
53+
}
54+
55+
MethodArgument other = (MethodArgument) o;
56+
return name().equals(other.name())
57+
&& type().equals(other.type())
58+
&& field().equals(other.field()) & nestedFields().equals(other.nestedFields())
59+
&& isResourceNameHelper() == other.isResourceNameHelper();
60+
}
61+
62+
@Override
63+
public int hashCode() {
64+
return 17 * name().hashCode()
65+
+ 19 * type().hashCode()
66+
+ 23 * field().hashCode()
67+
+ 29 * nestedFields().hashCode()
68+
+ (isResourceNameHelper() ? 1 : 0) * 31;
69+
}
70+
4971
public static Builder builder() {
5072
return new AutoValue_MethodArgument.Builder()
5173
.setNestedFields(ImmutableList.of())

0 commit comments

Comments
 (0)