Skip to content

Commit

Permalink
fix custom eq
Browse files Browse the repository at this point in the history
  • Loading branch information
candiduslynx committed Aug 17, 2023
1 parent 0c8e34c commit 0194a6f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
18 changes: 6 additions & 12 deletions lib/src/main/java/io/cloudquery/scalar/Binary.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,13 @@ public void setValue(Object value) throws ValidationException {

@Override
public boolean equals(Object other) {
if (!(other instanceof Binary o)) {
return false;
if (other instanceof Binary o) {
if (this.value == null) {
return o.value == null;
}
return Arrays.equals(this.value, o.value);
}

if (!o.getClass().equals(this.getClass())) {
return false;
}

if (this.value == null) {
return o.value == null;
}

return Arrays.equals(this.value, o.value);
return false;
}

public static class LargeBinary extends Binary {
Expand Down
11 changes: 11 additions & 0 deletions lib/src/main/java/io/cloudquery/scalar/UUID.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,17 @@ public void setValue(Object value) throws ValidationException {
throw new ValidationException(ValidationException.NO_CONVERSION_AVAILABLE, this.dataType(), value);
}

@Override
public final boolean equals(Object other) {
if (other instanceof UUID o) {
if (this.value == null) {
return o.value == null;
}
return this.value.equals(o.value);
}
return false;
}

@Override
public final int hashCode() {
return Objects.hash(value);
Expand Down

0 comments on commit 0194a6f

Please sign in to comment.