diff --git a/src/main/java/org/springframework/data/redis/support/atomic/RedisAtomicDouble.java b/src/main/java/org/springframework/data/redis/support/atomic/RedisAtomicDouble.java index c72db3d54..f01804da6 100644 --- a/src/main/java/org/springframework/data/redis/support/atomic/RedisAtomicDouble.java +++ b/src/main/java/org/springframework/data/redis/support/atomic/RedisAtomicDouble.java @@ -150,7 +150,7 @@ public class RedisAtomicDouble extends Number implements Serializable, BoundKeyO Double value = operations.get(key); if (value != null) { - return value.doubleValue(); + return value; } throw new DataRetrievalFailureException(String.format("The key '%s' seems to no longer exist.", key)); @@ -175,7 +175,7 @@ public class RedisAtomicDouble extends Number implements Serializable, BoundKeyO Double value = operations.getAndSet(key, newValue); - return value != null ? value.doubleValue() : 0; + return value != null ? value : 0; } /** @@ -186,7 +186,7 @@ public class RedisAtomicDouble extends Number implements Serializable, BoundKeyO * @return {@literal true} if successful. {@literal false} indicates that the actual value was not equal to the * expected value. */ - public boolean compareAndSet(final double expect, final double update) { + public boolean compareAndSet(double expect, double update) { return generalOps.execute(new CompareAndSet<>(this::get, this::set, key, expect, update)); } @@ -214,7 +214,7 @@ public class RedisAtomicDouble extends Number implements Serializable, BoundKeyO * @param delta the value to add * @return the previous value */ - public double getAndAdd(final double delta) { + public double getAndAdd(double delta) { return addAndGet(delta) - delta; } diff --git a/src/main/java/org/springframework/data/redis/support/atomic/RedisAtomicInteger.java b/src/main/java/org/springframework/data/redis/support/atomic/RedisAtomicInteger.java index c31431c73..265bd8e7a 100644 --- a/src/main/java/org/springframework/data/redis/support/atomic/RedisAtomicInteger.java +++ b/src/main/java/org/springframework/data/redis/support/atomic/RedisAtomicInteger.java @@ -148,7 +148,7 @@ public class RedisAtomicInteger extends Number implements Serializable, BoundKey Integer value = operations.get(key); if (value != null) { - return value.intValue(); + return value; } throw new DataRetrievalFailureException(String.format("The key '%s' seems to no longer exist.", key)); @@ -173,7 +173,7 @@ public class RedisAtomicInteger extends Number implements Serializable, BoundKey Integer value = operations.getAndSet(key, newValue); - return value != null ? value.intValue() : 0; + return value != null ? value : 0; } /** @@ -212,7 +212,7 @@ public class RedisAtomicInteger extends Number implements Serializable, BoundKey * @param delta the value to add. * @return the previous value. */ - public int getAndAdd(final int delta) { + public int getAndAdd(int delta) { return addAndGet(delta) - delta; } diff --git a/src/main/java/org/springframework/data/redis/support/atomic/RedisAtomicLong.java b/src/main/java/org/springframework/data/redis/support/atomic/RedisAtomicLong.java index a52069d33..c36b31f9a 100644 --- a/src/main/java/org/springframework/data/redis/support/atomic/RedisAtomicLong.java +++ b/src/main/java/org/springframework/data/redis/support/atomic/RedisAtomicLong.java @@ -155,7 +155,7 @@ public class RedisAtomicLong extends Number implements Serializable, BoundKeyOpe Long value = operations.get(key); if (value != null) { - return value.longValue(); + return value; } throw new DataRetrievalFailureException(String.format("The key '%s' seems to no longer exist.", key)); @@ -180,7 +180,7 @@ public class RedisAtomicLong extends Number implements Serializable, BoundKeyOpe Long value = operations.getAndSet(key, newValue); - return value != null ? value.longValue() : 0; + return value != null ? value : 0; } /** @@ -219,7 +219,7 @@ public class RedisAtomicLong extends Number implements Serializable, BoundKeyOpe * @param delta the value to add. * @return the previous value. */ - public long getAndAdd(final long delta) { + public long getAndAdd(long delta) { return addAndGet(delta) - delta; }