From 567f7161f324330373816c0dbe8f0c86909b03a5 Mon Sep 17 00:00:00 2001 From: Costin Leau Date: Tue, 9 Nov 2010 18:18:49 +0200 Subject: [PATCH] + refactor RedisCollection into RedisStore --- .../redis/util/AbstractRedisCollection.java | 2 +- .../datastore/redis/util/DefaultRedisSet.java | 6 ++ .../datastore/redis/util/RedisList.java | 2 +- .../datastore/redis/util/RedisSet.java | 2 +- .../datastore/redis/util/RedisSortedSet.java | 2 +- .../{RedisCollection.java => RedisStore.java} | 65 +++++++++---------- 6 files changed, 42 insertions(+), 37 deletions(-) rename spring-datastore-redis/src/main/java/org/springframework/datastore/redis/util/{RedisCollection.java => RedisStore.java} (78%) diff --git a/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/util/AbstractRedisCollection.java b/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/util/AbstractRedisCollection.java index 6d06b0b36..c9b7ffa1b 100644 --- a/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/util/AbstractRedisCollection.java +++ b/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/util/AbstractRedisCollection.java @@ -25,7 +25,7 @@ import org.springframework.datastore.redis.connection.RedisCommands; * * @author Costin Leau */ -public abstract class AbstractRedisCollection extends AbstractCollection implements RedisCollection { +public abstract class AbstractRedisCollection extends AbstractCollection implements RedisStore { protected final String key; protected final RedisCommands commands; diff --git a/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/util/DefaultRedisSet.java b/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/util/DefaultRedisSet.java index a981729a0..6dcbf749e 100644 --- a/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/util/DefaultRedisSet.java +++ b/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/util/DefaultRedisSet.java @@ -39,6 +39,12 @@ public class DefaultRedisSet extends AbstractRedisCollection implements RedisSet } } + /** + * Constructs a new DefaultRedisSet instance. + * + * @param key + * @param commands + */ public DefaultRedisSet(String key, RedisCommands commands) { super(key, commands); } diff --git a/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/util/RedisList.java b/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/util/RedisList.java index e17d01d10..82baa0f89 100644 --- a/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/util/RedisList.java +++ b/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/util/RedisList.java @@ -24,7 +24,7 @@ import java.util.Queue; * * @author Costin Leau */ -public interface RedisList extends RedisCollection, List, Queue { +public interface RedisList extends RedisStore, List, Queue { List range(int start, int end); diff --git a/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/util/RedisSet.java b/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/util/RedisSet.java index aa48032ac..a3e32202d 100644 --- a/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/util/RedisSet.java +++ b/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/util/RedisSet.java @@ -23,7 +23,7 @@ import java.util.Set; * * @author Costin Leau */ -public interface RedisSet extends RedisCollection, Set { +public interface RedisSet extends RedisStore, Set { Set intersect(RedisSet... sets); diff --git a/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/util/RedisSortedSet.java b/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/util/RedisSortedSet.java index 8f524e8b9..0e4acf169 100644 --- a/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/util/RedisSortedSet.java +++ b/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/util/RedisSortedSet.java @@ -24,7 +24,7 @@ import java.util.SortedSet; * * @author Costin Leau */ -public interface RedisSortedSet extends RedisCollection, SortedSet { +public interface RedisSortedSet extends RedisStore, SortedSet { RedisSortedSet intersectAndStore(String destKey, RedisSortedSet... sets); diff --git a/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/util/RedisCollection.java b/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/util/RedisStore.java similarity index 78% rename from spring-datastore-redis/src/main/java/org/springframework/datastore/redis/util/RedisCollection.java rename to spring-datastore-redis/src/main/java/org/springframework/datastore/redis/util/RedisStore.java index 68ef25383..1d0a64492 100644 --- a/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/util/RedisCollection.java +++ b/spring-datastore-redis/src/main/java/org/springframework/datastore/redis/util/RedisStore.java @@ -1,33 +1,32 @@ -/* - * Copyright 2006-2009 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.springframework.datastore.redis.util; - -import java.util.Collection; - -/** - * Basic interface for Redis collections. - * - * @author Costin Leau - */ -public interface RedisCollection extends Collection { - - /** - * Returns the key used by the backing Redis store for this collection. - * - * @return Redis key - */ - String getKey(); -} +/* + * Copyright 2010 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.datastore.redis.util; + + +/** + * Basic interface for Redis-based collections. + * + * @author Costin Leau + */ +public interface RedisStore { + + /** + * Returns the key used by the backing Redis store for this collection. + * + * @return Redis key + */ + String getKey(); +}