DATAREDIS-599 - Remove references to single-argument assertion methods of Spring.

This commit is contained in:
Christoph Strobl
2017-01-31 13:50:45 +01:00
parent 3e6235dab9
commit b749ae0c9c
19 changed files with 55 additions and 49 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2016 the original author or authors.
* Copyright 2015-2017 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.
@@ -73,9 +73,9 @@ public class ClusterCommandExecutor implements DisposableBean {
public ClusterCommandExecutor(ClusterTopologyProvider topologyProvider, ClusterNodeResourceProvider resourceProvider,
ExceptionTranslationStrategy exceptionTranslation) {
Assert.notNull(topologyProvider);
Assert.notNull(resourceProvider);
Assert.notNull(exceptionTranslation);
Assert.notNull(topologyProvider, "ClusterTopologyProvider must not be null!");
Assert.notNull(resourceProvider, "ClusterNodeResourceProvider must not be null!");
Assert.notNull(exceptionTranslation, "ExceptionTranslationStrategy must not be null!");
this.topologyProvider = topologyProvider;
this.resourceProvider = resourceProvider;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2014-2015 the original author or authors.
* Copyright 2014-2017 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.
@@ -158,7 +158,7 @@ public class RedisSentinelConfiguration {
*/
public void setMaster(NamedNode master) {
notNull("Sentinel master node must not be 'null'.");
notNull(master, "Sentinel master node must not be 'null'.");
this.master = master;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2016 the original author or authors.
* Copyright 2015-2017 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.
@@ -607,7 +607,7 @@ public class JedisClusterConnection implements RedisClusterConnection {
@Override
public List<byte[]> mGet(byte[]... keys) {
Assert.noNullElements(keys);
Assert.noNullElements(keys, "Keys must not contain null elements!");
if (ClusterSlotHashUtil.isSameSlotForAllKeys(keys)) {
return cluster.mget(keys);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2011-2016 the original author or authors.
* Copyright 2011-2017 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.
@@ -287,7 +287,7 @@ public class JedisConnectionFactory implements InitializingBean, DisposableBean,
*/
protected JedisCluster createCluster(RedisClusterConfiguration clusterConfig, GenericObjectPoolConfig poolConfig) {
Assert.notNull("Cluster configuration must not be null!");
Assert.notNull(clusterConfig, "Cluster configuration must not be null!");
Set<HostAndPort> hostAndPort = new HashSet<HostAndPort>();
for (RedisNode node : clusterConfig.getClusterNodes()) {
@@ -610,7 +610,7 @@ public class JedisConnectionFactory implements InitializingBean, DisposableBean,
private Jedis getActiveSentinel() {
Assert.notNull(this.sentinelConfig);
Assert.notNull(this.sentinelConfig, "SentinelConfig must not be null!");
for (RedisNode node : this.sentinelConfig.getSentinels()) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2016 the original author or authors.
* Copyright 2013-2017 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.
@@ -334,7 +334,7 @@ abstract public class JedisConverters extends Converters {
}
public static LIST_POSITION toListPosition(Position source) {
Assert.notNull("list positions are mandatory");
Assert.notNull(source, "list positions are mandatory");
return (Position.AFTER.equals(source) ? LIST_POSITION.AFTER : LIST_POSITION.BEFORE);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2011-2013 the original author or authors.
* Copyright 2011-2017 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.
@@ -216,7 +216,7 @@ public abstract class JedisUtils {
}
static LIST_POSITION convertPosition(Position where) {
Assert.notNull("list positions are mandatory");
Assert.notNull(where, "list positions are mandatory");
return (Position.AFTER.equals(where) ? LIST_POSITION.AFTER : LIST_POSITION.BEFORE);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2013-2016 the original author or authors.
* Copyright 2013-2017 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.
@@ -462,7 +462,7 @@ abstract public class LettuceConverters extends Converters {
}
public static boolean toBoolean(Position where) {
Assert.notNull("list positions are mandatory");
Assert.notNull(where, "list positions are mandatory");
return (Position.AFTER.equals(where) ? false : true);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2011-2013 the original author or authors.
* Copyright 2011-2017 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.
@@ -52,7 +52,7 @@ public abstract class AbstractSubscription implements Subscription {
* @param patterns
*/
protected AbstractSubscription(MessageListener listener, byte[][] channels, byte[][] patterns) {
Assert.notNull(listener);
Assert.notNull(listener, "MessageListener must not be null!");
this.listener = listener;
synchronized (this.channels) {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2011-2015 the original author or authors.
* Copyright 2011-2017 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.
@@ -79,7 +79,7 @@ public class CustomConversions {
*/
public CustomConversions(List<?> converters) {
Assert.notNull(converters);
Assert.notNull(converters,"Converters must not be null!");
this.readingPairs = new LinkedHashSet<ConvertiblePair>();
this.writingPairs = new LinkedHashSet<ConvertiblePair>();
@@ -344,8 +344,8 @@ public class CustomConversions {
private static Class<?> getCustomTarget(Class<?> sourceType, Class<?> requestedTargetType,
Collection<ConvertiblePair> pairs) {
Assert.notNull(sourceType);
Assert.notNull(pairs);
Assert.notNull(sourceType, "SourceType must not be null!");
Assert.notNull(pairs, "Convertible pairs must not be null!");
if (requestedTargetType != null && pairs.contains(new ConvertiblePair(sourceType, requestedTargetType))) {
return requestedTargetType;
@@ -411,7 +411,7 @@ public class CustomConversions {
*/
public ConverterRegistration(ConvertiblePair convertiblePair, boolean isReading, boolean isWriting) {
Assert.notNull(convertiblePair);
Assert.notNull(convertiblePair, "Convertible pair must not be null!");
this.convertiblePair = convertiblePair;
this.reading = isReading;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015 the original author or authors.
* Copyright 2015-2017 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.
@@ -112,7 +112,7 @@ public class KeyspaceConfiguration {
*/
public void addKeyspaceSettings(KeyspaceSettings keyspaceSettings) {
Assert.notNull(keyspaceSettings);
Assert.notNull(keyspaceSettings, "KeyspaceSettings must not be null!");
this.settingsMap.put(keyspaceSettings.getType(), keyspaceSettings);
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 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.
@@ -42,7 +42,7 @@ public class ReferenceResolverImpl implements ReferenceResolver {
*/
public ReferenceResolverImpl(RedisOperations<?, ?> redisOperations) {
Assert.notNull(redisOperations);
Assert.notNull(redisOperations, "RedisOperations must not be null!");
this.redisOps = redisOperations;
this.converter = new StringToBytesConverter();

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015 the original author or authors.
* Copyright 2015-2017 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.
@@ -86,7 +86,7 @@ public class BasicRedisPersistentEntity<T> extends BasicKeyValuePersistentEntity
protected KeyValuePersistentProperty returnPropertyIfBetterIdPropertyCandidateOrNull(
KeyValuePersistentProperty property) {
Assert.notNull(property);
Assert.notNull(property, "Property must not be null!");
if (!property.isIdProperty()) {
return null;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 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.
@@ -43,6 +43,7 @@ import org.springframework.util.StringUtils;
* Base class for {@link Bean} wrappers.
*
* @author Mark Paluch
* @author Christoph Strobl
*/
public abstract class CdiBean<T> implements Bean<T>, PassivationCapable {
@@ -76,10 +77,10 @@ public abstract class CdiBean<T> implements Bean<T>, PassivationCapable {
*/
public CdiBean(Set<Annotation> qualifiers, Set<Type> types, Class<T> beanClass, BeanManager beanManager) {
Assert.notNull(qualifiers);
Assert.notNull(beanManager);
Assert.notNull(types);
Assert.notNull(beanClass);
Assert.notNull(qualifiers, "Qualifier annotations must not be null!");
Assert.notNull(beanManager, "BeanManager must not be null!");
Assert.notNull(types, "Types must not be null!");
Assert.notNull(beanClass, "Bean class mast not be null!");
this.qualifiers = qualifiers;
this.types = types;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 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.
@@ -35,6 +35,7 @@ import org.springframework.util.Assert;
* {@link CdiBean} to create {@link RedisKeyValueAdapter} instances.
*
* @author Mark Paluch
* @author Christoph Strobl
*/
public class RedisKeyValueAdapterBean extends CdiBean<RedisKeyValueAdapter> {
@@ -45,14 +46,13 @@ public class RedisKeyValueAdapterBean extends CdiBean<RedisKeyValueAdapter> {
*
* @param redisOperations must not be {@literal null}.
* @param qualifiers must not be {@literal null}.
* @param repositoryType must not be {@literal null}.
* @param beanManager must not be {@literal null}.
*/
public RedisKeyValueAdapterBean(Bean<RedisOperations<?, ?>> redisOperations, Set<Annotation> qualifiers,
BeanManager beanManager) {
super(qualifiers, RedisKeyValueAdapter.class, beanManager);
Assert.notNull(redisOperations);
Assert.notNull(redisOperations, "RedisOperations Bean must not be null!");
this.redisOperations = redisOperations;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 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.
@@ -34,6 +34,7 @@ import org.springframework.util.Assert;
* {@link CdiBean} to create {@link RedisKeyValueTemplate} instances.
*
* @author Mark Paluch
* @author Christoph Strobl
*/
public class RedisKeyValueTemplateBean extends CdiBean<KeyValueOperations> {
@@ -50,7 +51,7 @@ public class RedisKeyValueTemplateBean extends CdiBean<KeyValueOperations> {
BeanManager beanManager) {
super(qualifiers, KeyValueOperations.class, beanManager);
Assert.notNull(keyValueAdapter);
Assert.notNull(keyValueAdapter, "KeyValueAdapter bean must not be null!");
this.keyValueAdapter = keyValueAdapter;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2016 the original author or authors.
* Copyright 2016-2017 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.
@@ -34,6 +34,7 @@ import org.springframework.util.Assert;
* {@link CdiRepositoryBean} to create Redis repository instances.
*
* @author Mark Paluch
* @author Christoph Strobl
*/
public class RedisRepositoryBean<T> extends CdiRepositoryBean<T> {
@@ -53,7 +54,7 @@ public class RedisRepositoryBean<T> extends CdiRepositoryBean<T> {
Class<T> repositoryType, BeanManager beanManager, CustomRepositoryImplementationDetector detector) {
super(qualifiers, repositoryType, beanManager, detector);
Assert.notNull(keyValueTemplate);
Assert.notNull(keyValueTemplate, "Bean holding keyvalue template must not be null!");
this.keyValueTemplate = keyValueTemplate;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2011-2013 the original author or authors.
* Copyright 2011-2017 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.
@@ -33,6 +33,7 @@ import org.springframework.util.Assert;
* bean. <b>Note:</b> Does not handle nulls in any special way delegating everything to the container.
*
* @author Costin Leau
* @author Christoph Strobl
*/
public class GenericToStringSerializer<T> implements RedisSerializer<T>, BeanFactoryAware {
@@ -45,7 +46,7 @@ public class GenericToStringSerializer<T> implements RedisSerializer<T>, BeanFac
}
public GenericToStringSerializer(Class<T> type, Charset charset) {
Assert.notNull(type);
Assert.notNull(type, "tyoe must not be null!");
this.type = type;
this.charset = charset;
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2011-2016 the original author or authors.
* Copyright 2011-2017 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.
@@ -30,6 +30,7 @@ import org.springframework.util.Assert;
* @author Mark Pollack
* @author Costin Leau
* @author Mark Paluch
* @author Christoph Strobl
*/
public class JdkSerializationRedisSerializer implements RedisSerializer<Object> {
@@ -63,8 +64,8 @@ public class JdkSerializationRedisSerializer implements RedisSerializer<Object>
*/
public JdkSerializationRedisSerializer(Converter<Object, byte[]> serializer, Converter<byte[], Object> deserializer) {
Assert.notNull("Serializer must not be null!");
Assert.notNull("Deserializer must not be null!");
Assert.notNull(serializer, "Serializer must not be null!");
Assert.notNull(deserializer, "Deserializer must not be null!");
this.serializer = serializer;
this.deserializer = deserializer;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2011-2013 the original author or authors.
* Copyright 2011-2017 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.
@@ -28,6 +28,7 @@ import org.springframework.util.Assert;
* Does not perform any null conversion since empty strings are valid keys/values.
*
* @author Costin Leau
* @author Christoph Strobl
*/
public class StringRedisSerializer implements RedisSerializer<String> {
@@ -38,7 +39,7 @@ public class StringRedisSerializer implements RedisSerializer<String> {
}
public StringRedisSerializer(Charset charset) {
Assert.notNull(charset);
Assert.notNull(charset, "Charset must not be null!");
this.charset = charset;
}