From 213d7b79111354101042247382082c8a16786457 Mon Sep 17 00:00:00 2001 From: Costin Leau Date: Tue, 8 Feb 2011 18:29:30 +0200 Subject: [PATCH] + javadoc tweaks --- .../SubscribedRedisConnectionException.java | 2 +- .../DefaultStringRedisConnection.java | 6 ++++-- .../data/keyvalue/redis/connection/Message.java | 10 ++++++++++ .../redis/connection/RedisListCommands.java | 7 +++++-- .../redis/connection/RedisPubSubCommands.java | 4 ++-- .../redis/connection/RedisZSetCommands.java | 6 ++++++ .../redis/connection/SortParameters.java | 4 +++- .../redis/connection/StringRedisConnection.java | 5 ++++- .../redis/connection/jedis/JedisConnection.java | 2 +- .../redis/connection/jedis/JedisUtils.java | 6 +++--- .../connection/jredis/JredisConnection.java | 2 +- .../data/keyvalue/redis/core/RedisTemplate.java | 17 ++++++++--------- .../data/keyvalue/redis/listener/Topic.java | 5 +++++ .../redis/listener/adapter/package-info.java | 7 +++++++ .../keyvalue/redis/listener/package-info.java | 5 +++++ .../redis/support/atomic/RedisAtomicLong.java | 4 ++-- 16 files changed, 67 insertions(+), 25 deletions(-) create mode 100644 spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/listener/adapter/package-info.java create mode 100644 spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/listener/package-info.java diff --git a/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/SubscribedRedisConnectionException.java b/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/SubscribedRedisConnectionException.java index 980105de1..2a1945e57 100644 --- a/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/SubscribedRedisConnectionException.java +++ b/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/SubscribedRedisConnectionException.java @@ -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 { diff --git a/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/DefaultStringRedisConnection.java b/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/DefaultStringRedisConnection.java index 5766db582..57e9fb804 100644 --- a/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/DefaultStringRedisConnection.java +++ b/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/DefaultStringRedisConnection.java @@ -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)); } diff --git a/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/Message.java b/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/Message.java index 526b19eb5..0a1b17010 100644 --- a/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/Message.java +++ b/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/Message.java @@ -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(); } diff --git a/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/RedisListCommands.java b/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/RedisListCommands.java index b251e0488..75b0520b8 100644 --- a/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/RedisListCommands.java +++ b/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/RedisListCommands.java @@ -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); diff --git a/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/RedisPubSubCommands.java b/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/RedisPubSubCommands.java index 56c20bc64..3fa37ffe8 100644 --- a/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/RedisPubSubCommands.java +++ b/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/RedisPubSubCommands.java @@ -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(); diff --git a/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/RedisZSetCommands.java b/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/RedisZSetCommands.java index 626784396..7ede85506 100644 --- a/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/RedisZSetCommands.java +++ b/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/RedisZSetCommands.java @@ -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(); diff --git a/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/SortParameters.java b/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/SortParameters.java index c49e2a6f4..0fd65c0b3 100644 --- a/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/SortParameters.java +++ b/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/SortParameters.java @@ -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; diff --git a/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/StringRedisConnection.java b/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/StringRedisConnection.java index 298809829..7622c3b56 100644 --- a/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/StringRedisConnection.java +++ b/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/StringRedisConnection.java @@ -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); diff --git a/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/jedis/JedisConnection.java b/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/jedis/JedisConnection.java index a0f84e115..08833b217 100644 --- a/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/jedis/JedisConnection.java +++ b/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/jedis/JedisConnection.java @@ -916,7 +916,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); diff --git a/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/jedis/JedisUtils.java b/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/jedis/JedisUtils.java index 202a7ccbf..ee83bd9bd 100644 --- a/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/jedis/JedisUtils.java +++ b/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/jedis/JedisUtils.java @@ -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) { diff --git a/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/jredis/JredisConnection.java b/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/jredis/JredisConnection.java index 486340bad..acd879bd3 100644 --- a/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/jredis/JredisConnection.java +++ b/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/connection/jredis/JredisConnection.java @@ -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(); } diff --git a/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/core/RedisTemplate.java b/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/core/RedisTemplate.java index 21866fe86..718f73ace 100644 --- a/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/core/RedisTemplate.java +++ b/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/core/RedisTemplate.java @@ -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 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 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 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 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 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 extends RedisAccessor implements RedisOperation return execute(new RedisCallback() { @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 extends RedisAccessor implements RedisOperation return execute(new RedisCallback() { @Override public Long doInRedis(RedisConnection connection) { - return connection.lInsert(rawKey, POSITION.AFTER, rawPivot, rawValue); + return connection.lInsert(rawKey, Position.AFTER, rawPivot, rawValue); } }, true); } diff --git a/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/listener/Topic.java b/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/listener/Topic.java index 4c3c8380c..351257469 100644 --- a/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/listener/Topic.java +++ b/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/listener/Topic.java @@ -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(); } diff --git a/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/listener/adapter/package-info.java b/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/listener/adapter/package-info.java new file mode 100644 index 000000000..69f9d096a --- /dev/null +++ b/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/listener/adapter/package-info.java @@ -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; + diff --git a/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/listener/package-info.java b/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/listener/package-info.java new file mode 100644 index 000000000..a074feaa6 --- /dev/null +++ b/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/listener/package-info.java @@ -0,0 +1,5 @@ +/** + * Base package for Redis message listener / pubsub container facility + */ +package org.springframework.data.keyvalue.redis.listener; + diff --git a/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/support/atomic/RedisAtomicLong.java b/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/support/atomic/RedisAtomicLong.java index fa88d8656..b1c6c8bbf 100644 --- a/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/support/atomic/RedisAtomicLong.java +++ b/spring-data-redis/src/main/java/org/springframework/data/keyvalue/redis/support/atomic/RedisAtomicLong.java @@ -78,8 +78,8 @@ public class RedisAtomicLong extends Number implements Serializable, KeyBoundRedisAtomicLong 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