Rename RedisAssertions.requiredObject(..) to requireNonNull(..).
Closes #2621
This commit is contained in:
@@ -178,10 +178,10 @@ public class RedisCacheManager extends AbstractTransactionSupportingCacheManager
|
||||
private RedisCacheManager(RedisCacheWriter cacheWriter, RedisCacheConfiguration defaultCacheConfiguration,
|
||||
boolean allowRuntimeCacheCreation) {
|
||||
|
||||
this.defaultCacheConfiguration = RedisAssertions.requireObject(defaultCacheConfiguration,
|
||||
this.defaultCacheConfiguration = RedisAssertions.requireNonNull(defaultCacheConfiguration,
|
||||
"DefaultCacheConfiguration must not be null");
|
||||
|
||||
this.cacheWriter = RedisAssertions.requireObject(cacheWriter, "CacheWriter must not be null");
|
||||
this.cacheWriter = RedisAssertions.requireNonNull(cacheWriter, "CacheWriter must not be null");
|
||||
this.initialCacheConfiguration = new LinkedHashMap<>();
|
||||
this.allowRuntimeCacheCreation = allowRuntimeCacheCreation;
|
||||
}
|
||||
@@ -410,7 +410,7 @@ public class RedisCacheManager extends AbstractTransactionSupportingCacheManager
|
||||
* @see org.springframework.data.redis.cache.RedisCacheWriter
|
||||
*/
|
||||
public static RedisCacheManagerBuilder fromCacheWriter(RedisCacheWriter cacheWriter) {
|
||||
return new RedisCacheManagerBuilder(RedisAssertions.requireObject(cacheWriter,
|
||||
return new RedisCacheManagerBuilder(RedisAssertions.requireNonNull(cacheWriter,
|
||||
"CacheWriter must not be null"));
|
||||
}
|
||||
|
||||
@@ -427,7 +427,7 @@ public class RedisCacheManager extends AbstractTransactionSupportingCacheManager
|
||||
public static RedisCacheManagerBuilder fromConnectionFactory(RedisConnectionFactory connectionFactory) {
|
||||
|
||||
RedisCacheWriter cacheWriter = RedisCacheWriter.nonLockingRedisCacheWriter(
|
||||
RedisAssertions.requireObject(connectionFactory, "ConnectionFactory must not be null"));
|
||||
RedisAssertions.requireNonNull(connectionFactory, "ConnectionFactory must not be null"));
|
||||
|
||||
return new RedisCacheManagerBuilder(cacheWriter);
|
||||
}
|
||||
@@ -506,7 +506,7 @@ public class RedisCacheManager extends AbstractTransactionSupportingCacheManager
|
||||
*/
|
||||
public RedisCacheManagerBuilder cacheDefaults(RedisCacheConfiguration defaultCacheConfiguration) {
|
||||
|
||||
this.defaultCacheConfiguration = RedisAssertions.requireObject(defaultCacheConfiguration,
|
||||
this.defaultCacheConfiguration = RedisAssertions.requireNonNull(defaultCacheConfiguration,
|
||||
"DefaultCacheConfiguration must not be null");
|
||||
|
||||
return this;
|
||||
@@ -520,7 +520,7 @@ public class RedisCacheManager extends AbstractTransactionSupportingCacheManager
|
||||
* @since 2.3
|
||||
*/
|
||||
public RedisCacheManagerBuilder cacheWriter(RedisCacheWriter cacheWriter) {
|
||||
this.cacheWriter = RedisAssertions.requireObject(cacheWriter, "CacheWriter must not be null");
|
||||
this.cacheWriter = RedisAssertions.requireNonNull(cacheWriter, "CacheWriter must not be null");
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -544,7 +544,7 @@ public class RedisCacheManager extends AbstractTransactionSupportingCacheManager
|
||||
*/
|
||||
public RedisCacheManagerBuilder initialCacheNames(Set<String> cacheNames) {
|
||||
|
||||
RedisAssertions.requireObject(cacheNames, "CacheNames must not be null")
|
||||
RedisAssertions.requireNonNull(cacheNames, "CacheNames must not be null")
|
||||
.forEach(it -> withCacheConfiguration(it, defaultCacheConfiguration));
|
||||
|
||||
return this;
|
||||
@@ -589,8 +589,8 @@ public class RedisCacheManager extends AbstractTransactionSupportingCacheManager
|
||||
public RedisCacheManagerBuilder withInitialCacheConfigurations(
|
||||
Map<String, RedisCacheConfiguration> cacheConfigurations) {
|
||||
|
||||
RedisAssertions.requireObject(cacheConfigurations, "CacheConfigurations must not be null")
|
||||
.forEach((cacheName, cacheConfiguration) -> RedisAssertions.requireObject(cacheConfiguration,
|
||||
RedisAssertions.requireNonNull(cacheConfigurations, "CacheConfigurations must not be null")
|
||||
.forEach((cacheName, cacheConfiguration) -> RedisAssertions.requireNonNull(cacheConfiguration,
|
||||
"RedisCacheConfiguration for cache [%s] must not be null", cacheName));
|
||||
|
||||
this.initialCaches.putAll(cacheConfigurations);
|
||||
|
||||
@@ -76,7 +76,7 @@ public class RedisClusterNode extends RedisNode {
|
||||
|
||||
this(SlotRange.empty());
|
||||
|
||||
this.id = RedisAssertions.requireObject(id, "Id must not be null");
|
||||
this.id = RedisAssertions.requireNonNull(id, "Id must not be null");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -87,7 +87,7 @@ public class RedisClusterNode extends RedisNode {
|
||||
public RedisClusterNode(SlotRange slotRange) {
|
||||
|
||||
this.flags = Collections.emptySet();
|
||||
this.slotRange = RedisAssertions.requireObject(slotRange,"SlotRange must not be null");
|
||||
this.slotRange = RedisAssertions.requireNonNull(slotRange,"SlotRange must not be null");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -102,7 +102,7 @@ public class RedisClusterNode extends RedisNode {
|
||||
super(host, port);
|
||||
|
||||
this.flags = Collections.emptySet();
|
||||
this.slotRange = RedisAssertions.requireObject(slotRange,"SlotRange must not be null");
|
||||
this.slotRange = RedisAssertions.requireNonNull(slotRange,"SlotRange must not be null");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -180,9 +180,9 @@ public class GenericJackson2JsonRedisSerializer implements RedisSerializer<Objec
|
||||
private GenericJackson2JsonRedisSerializer(ObjectMapper mapper, JacksonObjectReader reader,
|
||||
JacksonObjectWriter writer, @Nullable String typeHintPropertyName) {
|
||||
|
||||
this.mapper = RedisAssertions.requireObject(mapper, "ObjectMapper must not be null");
|
||||
this.reader = RedisAssertions.requireObject(reader, "Reader must not be null");
|
||||
this.writer = RedisAssertions.requireObject(writer, "Writer must not be null");
|
||||
this.mapper = RedisAssertions.requireNonNull(mapper, "ObjectMapper must not be null");
|
||||
this.reader = RedisAssertions.requireNonNull(reader, "Reader must not be null");
|
||||
this.writer = RedisAssertions.requireNonNull(writer, "Writer must not be null");
|
||||
|
||||
this.defaultTypingEnabled = Lazy.of(() -> mapper.getSerializationConfig()
|
||||
.getDefaultTyper(null) != null);
|
||||
|
||||
@@ -77,8 +77,8 @@ public class JdkSerializationRedisSerializer implements RedisSerializer<Object>
|
||||
public JdkSerializationRedisSerializer(Converter<Object, byte[]> serializer,
|
||||
Converter<byte[], Object> deserializer) {
|
||||
|
||||
this.serializer = RedisAssertions.requireObject(serializer, "Serializer must not be null");
|
||||
this.deserializer = RedisAssertions.requireObject(deserializer, "Deserializer must not be null");
|
||||
this.serializer = RedisAssertions.requireNonNull(serializer, "Serializer must not be null");
|
||||
this.deserializer = RedisAssertions.requireNonNull(deserializer, "Deserializer must not be null");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -37,10 +37,10 @@ public abstract class RedisAssertions {
|
||||
* @param arguments array of {@link Object} arguments used to format the {@link String message}.
|
||||
* @return the given {@link Object}.
|
||||
* @throws IllegalArgumentException if the {@link Object target} is {@literal null}.
|
||||
* @see #requireObject(Object, Supplier)
|
||||
* @see #requireNonNull(Object, Supplier)
|
||||
*/
|
||||
public static <T> T requireObject(@Nullable T target, String message, Object... arguments) {
|
||||
return requireObject(target, () -> String.format(message, arguments));
|
||||
public static <T> T requireNonNull(@Nullable T target, String message, Object... arguments) {
|
||||
return requireNonNull(target, () -> String.format(message, arguments));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -52,7 +52,7 @@ public abstract class RedisAssertions {
|
||||
* @return the given {@link Object}.
|
||||
* @throws IllegalArgumentException if the {@link Object target} is {@literal null}.
|
||||
*/
|
||||
public static <T> T requireObject(@Nullable T target, Supplier<String> message) {
|
||||
public static <T> T requireNonNull(@Nullable T target, Supplier<String> message) {
|
||||
Assert.notNull(target, message);
|
||||
return target;
|
||||
}
|
||||
@@ -66,7 +66,7 @@ public abstract class RedisAssertions {
|
||||
* @param arguments array of {@link Object} arguments used to format the {@link String message}.
|
||||
* @return the given {@link Object}.
|
||||
* @throws IllegalArgumentException if the {@link Object target} is {@literal null}.
|
||||
* @see #requireObject(Object, Supplier)
|
||||
* @see #requireNonNull(Object, Supplier)
|
||||
*/
|
||||
public static <T> T requireState(@Nullable T target, String message, Object... arguments) {
|
||||
return requireState(target, () -> String.format(message, arguments));
|
||||
|
||||
Reference in New Issue
Block a user