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:
Mark Paluch
2020-02-13 13:59:31 +01:00
parent 34ceee0675
commit c758a042c8
3 changed files with 33 additions and 20 deletions

View File

@@ -54,7 +54,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.
@@ -64,11 +65,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));
@@ -109,10 +110,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

View File

@@ -55,7 +55,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.
@@ -65,18 +66,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.
@@ -87,10 +90,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.

View File

@@ -56,7 +56,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.
@@ -66,11 +66,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));
@@ -99,7 +100,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.
@@ -110,7 +111,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