DATAREDIS-930 - Polishing.

Add since tags. Simplify test using Lombok annotations. Reformat code.

Original pull request: #385.
This commit is contained in:
Mark Paluch
2019-02-15 11:06:04 +01:00
parent 34951495ba
commit 2622f054ab
3 changed files with 18 additions and 37 deletions

View File

@@ -90,6 +90,7 @@ public interface RedisConfiguration {
/**
* @param configuration can be {@literal null}.
* @return {@code true} if given {@link RedisConfiguration} is instance of {@link WithHostAndPort}.
* @since 2.1.6
*/
static boolean isHostAndPortAware(@Nullable RedisConfiguration configuration) {
return configuration instanceof WithHostAndPort;
@@ -151,6 +152,7 @@ public interface RedisConfiguration {
* {@link #isHostAndPortAware(RedisConfiguration) port aware}.
* @return never {@literal null}.
* @throws IllegalArgumentException if {@code other} is {@literal null}.
* @since 2.1.6
*/
static int getPortOrElse(@Nullable RedisConfiguration configuration, IntSupplier other) {
@@ -164,6 +166,7 @@ public interface RedisConfiguration {
* {@link #isHostAndPortAware(RedisConfiguration) host aware}.
* @return never {@literal null}.
* @throws IllegalArgumentException if {@code other} is {@literal null}.
* @since 2.1.6
*/
static String getHostOrElse(@Nullable RedisConfiguration configuration, Supplier<String> other) {

View File

@@ -1008,8 +1008,8 @@ public class LettuceConnectionFactory
private RedisURI getSentinelRedisURI() {
RedisURI redisUri = LettuceConverters
.sentinelConfigurationToRedisURI((org.springframework.data.redis.connection.RedisSentinelConfiguration) configuration);
RedisURI redisUri = LettuceConverters.sentinelConfigurationToRedisURI(
(org.springframework.data.redis.connection.RedisSentinelConfiguration) configuration);
getRedisPassword().toOptional().ifPresent(redisUri::setPassword);
clientConfiguration.getClientName().ifPresent(redisUri::setClientName);