DATAREDIS-1080 - Improve documentation on Atomic number implementations.
Clarify that the initialization value overwrites the existing key if it exists.
This commit is contained in:
@@ -51,7 +51,8 @@ public class RedisAtomicDouble extends Number implements Serializable, BoundKeyO
|
||||
private final RedisOperations<String, Double> generalOps;
|
||||
|
||||
/**
|
||||
* Constructs a new {@link RedisAtomicDouble} instance. Uses the value existing in Redis or 0 if none is found.
|
||||
* Constructs a new {@link RedisAtomicDouble} instance. Uses the value existing in Redis or {@code 0} if none is
|
||||
* found.
|
||||
*
|
||||
* @param redisCounter Redis key of this counter.
|
||||
* @param factory connection factory.
|
||||
@@ -61,11 +62,11 @@ public class RedisAtomicDouble extends Number implements Serializable, BoundKeyO
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@link RedisAtomicDouble} instance.
|
||||
* Constructs a new {@link RedisAtomicDouble} instance with a {@code initialValue} that overwrites the existing value.
|
||||
*
|
||||
* @param redisCounter Redis key of this counter.
|
||||
* @param factory connection factory.
|
||||
* @param initialValue initial value to set if the Redis key is absent.
|
||||
* @param initialValue initial value to set.
|
||||
*/
|
||||
public RedisAtomicDouble(String redisCounter, RedisConnectionFactory factory, double initialValue) {
|
||||
this(redisCounter, factory, Double.valueOf(initialValue));
|
||||
@@ -106,10 +107,14 @@ public class RedisAtomicDouble extends Number implements Serializable, BoundKeyO
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@link RedisAtomicDouble} instance. Note: You need to configure the given {@code template} with
|
||||
* appropriate {@link RedisSerializer} for the key and value. As an alternative one could use the
|
||||
* {@link #RedisAtomicDouble(String, RedisConnectionFactory, Double)} constructor which uses appropriate default
|
||||
* serializers.
|
||||
* Constructs a new {@link RedisAtomicDouble} instance with a {@code initialValue} that overwrites the existing value
|
||||
* at {@code redisCounter}.
|
||||
* <p>
|
||||
* Note: You need to configure the given {@code template} with appropriate {@link RedisSerializer} for the key and
|
||||
* value.
|
||||
* <p>
|
||||
* As an alternative one could use the {@link #RedisAtomicDouble(String, RedisConnectionFactory, Double)} constructor
|
||||
* which uses appropriate default serializers.
|
||||
*
|
||||
* @param redisCounter Redis key of this counter.
|
||||
* @param template the template
|
||||
|
||||
@@ -52,7 +52,8 @@ public class RedisAtomicInteger extends Number implements Serializable, BoundKey
|
||||
private final RedisOperations<String, Integer> generalOps;
|
||||
|
||||
/**
|
||||
* Constructs a new {@link RedisAtomicInteger} instance. Uses the value existing in Redis or 0 if none is found.
|
||||
* Constructs a new {@link RedisAtomicInteger} instance. Uses the value existing in Redis or {@code 0} if none is
|
||||
* found.
|
||||
*
|
||||
* @param redisCounter Redis key of this counter.
|
||||
* @param factory connection factory.
|
||||
@@ -62,18 +63,20 @@ public class RedisAtomicInteger extends Number implements Serializable, BoundKey
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@link RedisAtomicInteger} instance.
|
||||
* Constructs a new {@link RedisAtomicInteger} instance with a {@code initialValue} that overwrites the existing
|
||||
* value.
|
||||
*
|
||||
* @param redisCounter Redis key of this counter.
|
||||
* @param factory connection factory.
|
||||
* @param initialValue initial value to set if the Redis key is absent.
|
||||
* @param initialValue initial value to set.
|
||||
*/
|
||||
public RedisAtomicInteger(String redisCounter, RedisConnectionFactory factory, int initialValue) {
|
||||
this(redisCounter, factory, Integer.valueOf(initialValue));
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@link RedisAtomicInteger} instance. Uses the value existing in Redis or 0 if none is found.
|
||||
* Constructs a new {@link RedisAtomicInteger} instance. Uses the value existing in Redis or {@code 0} if none is
|
||||
* found.
|
||||
*
|
||||
* @param redisCounter Redis key of this counter.
|
||||
* @param template the template.
|
||||
@@ -84,10 +87,14 @@ public class RedisAtomicInteger extends Number implements Serializable, BoundKey
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@link RedisAtomicInteger} instance. Note: You need to configure the given {@code template} with
|
||||
* appropriate {@link RedisSerializer} for the key and value. As an alternative one could use the
|
||||
* {@link #RedisAtomicInteger(String, RedisConnectionFactory, Integer)} constructor which uses appropriate default
|
||||
* serializers.
|
||||
* Constructs a new {@link RedisAtomicInteger} instance instance with a {@code initialValue} that overwrites the
|
||||
* existing value.
|
||||
* <p>
|
||||
* Note: You need to configure the given {@code template} with appropriate {@link RedisSerializer} for the key and
|
||||
* value.
|
||||
* <p>
|
||||
* As an alternative one could use the {@link #RedisAtomicInteger(String, RedisConnectionFactory, Integer)}
|
||||
* constructor which uses appropriate default serializers.
|
||||
*
|
||||
* @param redisCounter Redis key of this counter.
|
||||
* @param template the template.
|
||||
|
||||
@@ -53,7 +53,7 @@ public class RedisAtomicLong extends Number implements Serializable, BoundKeyOpe
|
||||
private final RedisOperations<String, Long> generalOps;
|
||||
|
||||
/**
|
||||
* Constructs a new {@link RedisAtomicLong} instance. Uses the value existing in Redis or 0 if none is found.
|
||||
* Constructs a new {@link RedisAtomicLong} instance. Uses the value existing in Redis or {@code 0} if none is found.
|
||||
*
|
||||
* @param redisCounter Redis key of this counter.
|
||||
* @param factory connection factory.
|
||||
@@ -63,11 +63,12 @@ public class RedisAtomicLong extends Number implements Serializable, BoundKeyOpe
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@link RedisAtomicLong} instance.
|
||||
* Constructs a new {@link RedisAtomicLong} instance with a {@code initialValue} that overwrites the existing value at
|
||||
* {@code redisCounter}.
|
||||
*
|
||||
* @param redisCounter Redis key of this counter.
|
||||
* @param factory connection factory.
|
||||
* @param initialValue initial value to set if the Redis key is absent.
|
||||
* @param initialValue initial value to set.
|
||||
*/
|
||||
public RedisAtomicLong(String redisCounter, RedisConnectionFactory factory, long initialValue) {
|
||||
this(redisCounter, factory, Long.valueOf(initialValue));
|
||||
@@ -96,7 +97,7 @@ public class RedisAtomicLong extends Number implements Serializable, BoundKeyOpe
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@link RedisAtomicLong} instance. Uses the value existing in Redis or 0 if none is found.
|
||||
* Constructs a new {@link RedisAtomicLong} instance. Uses the value existing in Redis or {@code 0} if none is found.
|
||||
*
|
||||
* @param redisCounter Redis key of this counter.
|
||||
* @param template the template.
|
||||
@@ -107,7 +108,7 @@ public class RedisAtomicLong extends Number implements Serializable, BoundKeyOpe
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@link RedisAtomicLong} instance.
|
||||
* Constructs a new {@link RedisAtomicLong} instance with a {@code initialValue} that overwrites the existing value.
|
||||
* <p>
|
||||
* Note: You need to configure the given {@code template} with appropriate {@link RedisSerializer} for the key and
|
||||
* value. The key serializer must be able to deserialize to a {@link String} and the value serializer must be able to
|
||||
|
||||
Reference in New Issue
Block a user