+ javadoc tweaks
This commit is contained in:
@@ -22,7 +22,7 @@ import org.springframework.dao.InvalidDataAccessApiUsageException;
|
||||
* for events.
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @see RedisConnection#subscribe(org.springframework.data.keyvalue.redis.connection.MessageListener, byte[]...)
|
||||
* @see org.springframework.data.keyvalue.redis.connection.RedisPubSubCommands
|
||||
*/
|
||||
public class SubscribedRedisConnectionException extends InvalidDataAccessApiUsageException {
|
||||
|
||||
|
||||
@@ -30,6 +30,8 @@ import org.springframework.data.keyvalue.redis.serializer.StringRedisSerializer;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Default implementation of {@link StringRedisConnection}.
|
||||
*
|
||||
* @author Costin Leau
|
||||
*/
|
||||
public class DefaultStringRedisConnection implements StringRedisConnection {
|
||||
@@ -250,7 +252,7 @@ public class DefaultStringRedisConnection implements StringRedisConnection {
|
||||
return delegate.lIndex(key, index);
|
||||
}
|
||||
|
||||
public Long lInsert(byte[] key, POSITION where, byte[] pivot, byte[] value) {
|
||||
public Long lInsert(byte[] key, Position where, byte[] pivot, byte[] value) {
|
||||
return delegate.lInsert(key, where, pivot, value);
|
||||
}
|
||||
|
||||
@@ -777,7 +779,7 @@ public class DefaultStringRedisConnection implements StringRedisConnection {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long lInsert(String key, POSITION where, String pivot, String value) {
|
||||
public Long lInsert(String key, Position where, String pivot, String value) {
|
||||
return delegate.lInsert(serialize(key), where, serialize(pivot), serialize(value));
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,17 @@ import java.io.Serializable;
|
||||
*/
|
||||
public interface Message extends Serializable {
|
||||
|
||||
/**
|
||||
* Returns the body (or the payload) of the message.
|
||||
*
|
||||
* @return message body
|
||||
*/
|
||||
byte[] getBody();
|
||||
|
||||
/**
|
||||
* Returns the channel associated with the message.
|
||||
*
|
||||
* @return message channel.
|
||||
*/
|
||||
byte[] getChannel();
|
||||
}
|
||||
|
||||
@@ -25,7 +25,10 @@ import java.util.List;
|
||||
*/
|
||||
public interface RedisListCommands {
|
||||
|
||||
public enum POSITION {
|
||||
/**
|
||||
* List insertion position.
|
||||
*/
|
||||
public enum Position {
|
||||
BEFORE, AFTER
|
||||
}
|
||||
|
||||
@@ -45,7 +48,7 @@ public interface RedisListCommands {
|
||||
|
||||
byte[] lIndex(byte[] key, long index);
|
||||
|
||||
Long lInsert(byte[] key, POSITION where, byte[] pivot, byte[] value);
|
||||
Long lInsert(byte[] key, Position where, byte[] pivot, byte[] value);
|
||||
|
||||
void lSet(byte[] key, long index, byte[] value);
|
||||
|
||||
|
||||
@@ -27,8 +27,8 @@ public interface RedisPubSubCommands {
|
||||
* or not.
|
||||
*
|
||||
* @return true if the connection is subscribed, false otherwise
|
||||
* @see #subscribe(listener, channels)
|
||||
* @see #pSubscribe(listener, channels)
|
||||
* @see #subscribe(MessageListener, byte[]...)
|
||||
* @see #pSubscribe(MessageListener, byte[]...)
|
||||
*/
|
||||
boolean isSubscribed();
|
||||
|
||||
|
||||
@@ -26,10 +26,16 @@ import java.util.Set;
|
||||
*/
|
||||
public interface RedisZSetCommands {
|
||||
|
||||
/**
|
||||
* Sort aggregation operations.
|
||||
*/
|
||||
public enum Aggregate {
|
||||
SUM, MIN, MAX;
|
||||
}
|
||||
|
||||
/**
|
||||
* ZSet tuple.
|
||||
*/
|
||||
public interface Tuple {
|
||||
byte[] getValue();
|
||||
|
||||
|
||||
@@ -22,6 +22,9 @@ package org.springframework.data.keyvalue.redis.connection;
|
||||
*/
|
||||
public interface SortParameters {
|
||||
|
||||
/**
|
||||
* Sorting order.
|
||||
*/
|
||||
public enum Order {
|
||||
ASC, DESC
|
||||
}
|
||||
@@ -29,7 +32,6 @@ public interface SortParameters {
|
||||
/**
|
||||
* Utility class wrapping the 'LIMIT' setting.
|
||||
*
|
||||
* @author Costin Leau
|
||||
*/
|
||||
static class Range {
|
||||
private final long start;
|
||||
|
||||
@@ -35,6 +35,9 @@ import org.springframework.data.keyvalue.redis.serializer.RedisSerializer;
|
||||
*/
|
||||
public interface StringRedisConnection extends RedisConnection {
|
||||
|
||||
/**
|
||||
* String-friendly ZSet tuple.
|
||||
*/
|
||||
public interface StringTuple extends Tuple {
|
||||
String getValueAsString();
|
||||
}
|
||||
@@ -118,7 +121,7 @@ public interface StringRedisConnection extends RedisConnection {
|
||||
|
||||
String lIndex(String key, long index);
|
||||
|
||||
Long lInsert(String key, POSITION where, String pivot, String value);
|
||||
Long lInsert(String key, Position where, String pivot, String value);
|
||||
|
||||
void lSet(String key, long index, String value);
|
||||
|
||||
|
||||
@@ -1139,7 +1139,7 @@ public class JedisConnection implements RedisConnection {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long lInsert(byte[] key, POSITION where, byte[] pivot, byte[] value) {
|
||||
public Long lInsert(byte[] key, Position where, byte[] pivot, byte[] value) {
|
||||
try {
|
||||
if (isQueueing()) {
|
||||
// transaction.linsert(key, JedisUtils.convertPosition(where), pivot, value);
|
||||
|
||||
@@ -33,7 +33,7 @@ import org.springframework.data.keyvalue.redis.UncategorizedRedisException;
|
||||
import org.springframework.data.keyvalue.redis.connection.DefaultTuple;
|
||||
import org.springframework.data.keyvalue.redis.connection.MessageListener;
|
||||
import org.springframework.data.keyvalue.redis.connection.SortParameters;
|
||||
import org.springframework.data.keyvalue.redis.connection.RedisListCommands.POSITION;
|
||||
import org.springframework.data.keyvalue.redis.connection.RedisListCommands.Position;
|
||||
import org.springframework.data.keyvalue.redis.connection.RedisZSetCommands.Tuple;
|
||||
import org.springframework.data.keyvalue.redis.connection.SortParameters.Order;
|
||||
import org.springframework.data.keyvalue.redis.connection.SortParameters.Range;
|
||||
@@ -187,9 +187,9 @@ public abstract class JedisUtils {
|
||||
return (value ? ONE : ZERO);
|
||||
}
|
||||
|
||||
static LIST_POSITION convertPosition(POSITION where) {
|
||||
static LIST_POSITION convertPosition(Position where) {
|
||||
Assert.notNull("list positions are mandatory");
|
||||
return (POSITION.AFTER.equals(where) ? LIST_POSITION.AFTER : LIST_POSITION.BEFORE);
|
||||
return (Position.AFTER.equals(where) ? LIST_POSITION.AFTER : LIST_POSITION.BEFORE);
|
||||
}
|
||||
|
||||
static Properties info(String string) {
|
||||
|
||||
@@ -636,7 +636,7 @@ public class JredisConnection implements RedisConnection {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long lInsert(byte[] key, POSITION where, byte[] pivot, byte[] value) {
|
||||
public Long lInsert(byte[] key, Position where, byte[] pivot, byte[] value) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ import org.springframework.data.keyvalue.redis.connection.DataType;
|
||||
import org.springframework.data.keyvalue.redis.connection.RedisConnection;
|
||||
import org.springframework.data.keyvalue.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.keyvalue.redis.connection.SortParameters;
|
||||
import org.springframework.data.keyvalue.redis.connection.RedisListCommands.POSITION;
|
||||
import org.springframework.data.keyvalue.redis.connection.RedisListCommands.Position;
|
||||
import org.springframework.data.keyvalue.redis.serializer.JdkSerializationRedisSerializer;
|
||||
import org.springframework.data.keyvalue.redis.serializer.RedisSerializer;
|
||||
import org.springframework.data.keyvalue.redis.serializer.StringRedisSerializer;
|
||||
@@ -287,7 +287,7 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the key serializer to be used by this template. Defaults to {@link getDefaultSerializer}.
|
||||
* Sets the key serializer to be used by this template. Defaults to {@link #getDefaultSerializer()}.
|
||||
*
|
||||
* @param serializer the key serializer to be used by this template.
|
||||
*/
|
||||
@@ -305,7 +305,7 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value serializer to be used by this template. Defaults to {@link getDefaultSerializer}.
|
||||
* Sets the value serializer to be used by this template. Defaults to {@link #getDefaultSerializer()}.
|
||||
*
|
||||
* @param serializer the value serializer to be used by this template.
|
||||
*/
|
||||
@@ -323,7 +323,7 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the hash key (or field) serializer to be used by this template. Defaults to {@link getDefaultSerializer}.
|
||||
* Sets the hash key (or field) serializer to be used by this template. Defaults to {@link #getDefaultSerializer()}.
|
||||
*
|
||||
* @param hashKeySerializer The hashKeySerializer to set.
|
||||
*/
|
||||
@@ -332,7 +332,7 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the hash value serializer to be used by this template. Defaults to {@link getDefaultSerializer}.
|
||||
* Sets the hash value serializer to be used by this template. Defaults to {@link #getDefaultSerializer()}.
|
||||
*
|
||||
* @param hashValueSerializer The hashValueSerializer to set.
|
||||
*/
|
||||
@@ -352,8 +352,7 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
|
||||
}
|
||||
|
||||
/**
|
||||
* Invocation handler that suppresses close calls on JDO PersistenceManagers.
|
||||
* Also prepares returned Query objects.
|
||||
* Invocation handler that suppresses close calls on {@link RedisConnection}.
|
||||
* @see RedisConnection#close()
|
||||
*/
|
||||
private class CloseSuppressingInvocationHandler implements InvocationHandler {
|
||||
@@ -1120,7 +1119,7 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
|
||||
return execute(new RedisCallback<Long>() {
|
||||
@Override
|
||||
public Long doInRedis(RedisConnection connection) {
|
||||
return connection.lInsert(rawKey, POSITION.BEFORE, rawPivot, rawValue);
|
||||
return connection.lInsert(rawKey, Position.BEFORE, rawPivot, rawValue);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
@@ -1214,7 +1213,7 @@ public class RedisTemplate<K, V> extends RedisAccessor implements RedisOperation
|
||||
return execute(new RedisCallback<Long>() {
|
||||
@Override
|
||||
public Long doInRedis(RedisConnection connection) {
|
||||
return connection.lInsert(rawKey, POSITION.AFTER, rawPivot, rawValue);
|
||||
return connection.lInsert(rawKey, Position.AFTER, rawPivot, rawValue);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
@@ -23,5 +23,10 @@ package org.springframework.data.keyvalue.redis.listener;
|
||||
*/
|
||||
public interface Topic {
|
||||
|
||||
/**
|
||||
* Returns the topic (as a String).
|
||||
*
|
||||
* @return the topic
|
||||
*/
|
||||
String getTopic();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Message listener adapter package.
|
||||
* The adapter delegates to target listener methods, converting messages to appropriate message content types
|
||||
* (such as String or byte array) that get passed into listener methods.
|
||||
*/
|
||||
package org.springframework.data.keyvalue.redis.listener.adapter;
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
/**
|
||||
* Base package for Redis message listener / pubsub container facility
|
||||
*/
|
||||
package org.springframework.data.keyvalue.redis.listener;
|
||||
|
||||
@@ -78,8 +78,8 @@ public class RedisAtomicLong extends Number implements Serializable, KeyBound<St
|
||||
* Constructs a new <code>RedisAtomicLong</code> instance. Uses as initial value
|
||||
* the data from the backing store (sets the counter to 0 if no value is found).
|
||||
*
|
||||
* Use {@link #RedisAtomicLong(String, RedisOperations, int)} to set the counter to a certain value
|
||||
* as an alternative constructor or {@link #set(int)}.
|
||||
* Use {@link #RedisAtomicLong(String, RedisOperations, long)} to set the counter to a certain value
|
||||
* as an alternative constructor or {@link #set(long)}.
|
||||
*
|
||||
* @param redisCounter
|
||||
* @param operations
|
||||
|
||||
Reference in New Issue
Block a user