Skip to content

Commit

Permalink
SetParams should implement equals and hashcode
Browse files Browse the repository at this point in the history
  • Loading branch information
Lcarrot committed Feb 19, 2024
1 parent 65d431f commit 33f381d
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/main/java/redis/clients/jedis/params/SetParams.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
import redis.clients.jedis.CommandArguments;
import redis.clients.jedis.Protocol.Keyword;

import java.util.Objects;

public class SetParams implements IParams {

private Keyword existance;
Expand Down Expand Up @@ -106,4 +108,18 @@ public void addParams(CommandArguments args) {
}
}
}

@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
SetParams setParams = (SetParams) o;
return Objects.equals(existance, setParams.existance) && Objects.equals(expiration, setParams.expiration)
&& Objects.equals(expirationValue, setParams.expirationValue);
}

@Override
public int hashCode() {
return Objects.hash(existance, expiration, expirationValue);
}
}

0 comments on commit 33f381d

Please sign in to comment.