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 4ebda552b..c29a0e3d8 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 @@ -151,7 +151,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)); @@ -176,7 +176,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; } /** @@ -187,7 +187,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)); } @@ -215,7 +215,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 fd8edfced..1a2f4f492 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 @@ -149,7 +149,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)); @@ -174,7 +174,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; } /** @@ -213,7 +213,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 3495e4c69..d15d842f9 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; }