From 75341a7bba7f5c303f9dc30b05df5bb1f4b6ebe0 Mon Sep 17 00:00:00 2001 From: Costin Leau Date: Mon, 8 Nov 2010 16:04:52 +0200 Subject: [PATCH] + add backward compatible constructors --- .../redis/util/RedisAtomicInteger.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/util/RedisAtomicInteger.java b/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/util/RedisAtomicInteger.java index 6ef244e98..93a461cb0 100644 --- a/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/util/RedisAtomicInteger.java +++ b/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/util/RedisAtomicInteger.java @@ -33,9 +33,27 @@ public class RedisAtomicInteger extends Number implements Serializable { private final String key; private RedisCommands commands; + /** + * Constructs a new RedisAtomicInteger instance with an initial value of zero. + * + * @param redisCounter + * @param commands + */ public RedisAtomicInteger(String redisCounter, RedisCommands commands) { + this(redisCounter, commands, 0); + } + + /** + * Constructs a new RedisAtomicInteger instance with the given initial value. + * + * @param redisCounter + * @param commands + * @param value + */ + public RedisAtomicInteger(String redisCounter, RedisCommands commands, int value) { this.key = redisCounter; this.commands = commands; + commands.set(redisCounter, Integer.toString(value)); } /**