DATAREDIS-682 - Polishing.

Enforce nullability constraints and update documentation.

Original Pull Request: #286
This commit is contained in:
Christoph Strobl
2017-11-13 09:49:29 +01:00
parent d08ab93421
commit 3ec25eebb8
4 changed files with 13 additions and 8 deletions

View File

@@ -6,8 +6,9 @@ New and noteworthy in the latest releases.
[[new-in-2.1.0]]
== New in Spring Data Redis 2.1
* Unix domain socket connections.
* Unix domain socket connections using <<redis:connectors:lettuce,Lettuce>>.
[[new-in-2.0.0]]
== New in Spring Data Redis 2.0
* Upgrade to Java 8.

View File

@@ -18,10 +18,11 @@ package org.springframework.data.redis.connection;
import org.springframework.util.Assert;
/**
* Configuration class used for setting up {@link RedisConnection} via {@link RedisConnectionFactory} by connecting to a
* single node <a href="http://redis.io/">Redis</a> using a local unix domain socket.
* Configuration class used for setting up {@link RedisConnection} via {@link RedisConnectionFactory} connecting to
* single <a href="http://redis.io/">Redis</a> using a local unix domain socket.
*
* @author Mark Paluch
* @author Christoph Strobl
* @since 2.1
*/
public class RedisSocketConfiguration {
@@ -44,7 +45,7 @@ public class RedisSocketConfiguration {
*/
public RedisSocketConfiguration(String socket) {
Assert.hasText(socket, "Socket path must not be null or empty!");
Assert.hasText(socket, "Socket path must not be null nor empty!");
this.socket = socket;
}
@@ -60,6 +61,8 @@ public class RedisSocketConfiguration {
* @param socket path to the Redis socket.
*/
public void setSocket(String socket) {
Assert.hasText(socket, "Socket must not be null nor empty!");
this.socket = socket;
}

View File

@@ -794,7 +794,7 @@ public class LettuceConnectionFactory
}
/**
* @return the {@link RedisSocketConfiguration}.
* @return the {@link RedisSocketConfiguration} or {@literal null} if not set.
* @since 2.1
*/
@Nullable
@@ -939,6 +939,7 @@ public class LettuceConnectionFactory
RedisURI uri = isDomainSocketAware() ? createRedisSocketURIAndApplySettings(socketConfiguration.getSocket())
: createRedisURIAndApplySettings(getHostName(), getPort());
RedisClient redisClient = clientConfiguration.getClientResources() //
.map(clientResources -> RedisClient.create(clientResources, uri)) //
.orElseGet(() -> RedisClient.create(uri));

View File

@@ -23,7 +23,7 @@ import org.springframework.data.redis.connection.RedisStandaloneConfiguration;
/**
* Utility class exposing connection settings to connect Redis instances during test execution. Settings can be adjusted
* by overriding these in {@literal org/springframework/data/redis/test.properties}.
*
*
* @author Costin Leau
* @author Mark Paluch
*/
@@ -71,7 +71,7 @@ public abstract class SettingsUtils {
/**
* Construct a new {@link RedisStandaloneConfiguration} initialized with test endpoint settings.
*
*
* @return a new {@link RedisStandaloneConfiguration} initialized with test endpoint settings.
*/
public static RedisStandaloneConfiguration standaloneConfiguration() {
@@ -80,7 +80,7 @@ public abstract class SettingsUtils {
/**
* Construct a new {@link RedisSocketConfiguration} initialized with test endpoint settings.
*
*
* @return a new {@link RedisSocketConfiguration} initialized with test endpoint settings.
*/
public static RedisSocketConfiguration socketConfiguration() {