DATACOUCH-274 - Remove references to Assert single-arg methods.
Replace references to Assert single-arg methods with references to methods accepting the test object and message. Related ticket: SPR-15196.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2015 the original author or authors
|
||||
* Copyright 2012-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.
|
||||
@@ -24,6 +24,7 @@ import org.springframework.util.Assert;
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author Michael Nitschinger
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
class ConverterRegistration {
|
||||
|
||||
@@ -39,7 +40,7 @@ class ConverterRegistration {
|
||||
* @param isWriting whether to force to consider the converter for reading.
|
||||
*/
|
||||
public ConverterRegistration(ConvertiblePair convertiblePair, boolean isReading, boolean isWriting) {
|
||||
Assert.notNull(convertiblePair);
|
||||
Assert.notNull(convertiblePair, "ConvertiblePair must not be null!");
|
||||
|
||||
this.convertiblePair = convertiblePair;
|
||||
reading = isReading;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2015 the original author or authors
|
||||
* Copyright 2012-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.
|
||||
@@ -45,6 +45,7 @@ import org.springframework.util.Assert;
|
||||
*
|
||||
* @author Michael Nitschinger
|
||||
* @author Oliver Gierke
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public class CustomConversions {
|
||||
|
||||
@@ -77,7 +78,7 @@ public class CustomConversions {
|
||||
* @param converters the list of custom converters.
|
||||
*/
|
||||
public CustomConversions(final List<?> converters) {
|
||||
Assert.notNull(converters);
|
||||
Assert.notNull(converters, "List of Converters must not be null!");
|
||||
|
||||
readingPairs = new LinkedHashSet<GenericConverter.ConvertiblePair>();
|
||||
writingPairs = new LinkedHashSet<GenericConverter.ConvertiblePair>();
|
||||
@@ -216,7 +217,7 @@ public class CustomConversions {
|
||||
* @return
|
||||
*/
|
||||
public Class<?> getCustomWriteTarget(Class<?> sourceType, Class<?> requestedTargetType) {
|
||||
Assert.notNull(sourceType);
|
||||
Assert.notNull(sourceType, "Source type must not be null!");
|
||||
return getCustomTarget(sourceType, requestedTargetType, writingPairs);
|
||||
}
|
||||
|
||||
@@ -228,7 +229,7 @@ public class CustomConversions {
|
||||
* @return
|
||||
*/
|
||||
public boolean hasCustomWriteTarget(Class<?> sourceType) {
|
||||
Assert.notNull(sourceType);
|
||||
Assert.notNull(sourceType, "Source type must not be null!");
|
||||
return hasCustomWriteTarget(sourceType, null);
|
||||
}
|
||||
|
||||
@@ -241,7 +242,7 @@ public class CustomConversions {
|
||||
* @return
|
||||
*/
|
||||
public boolean hasCustomWriteTarget(Class<?> sourceType, Class<?> requestedTargetType) {
|
||||
Assert.notNull(sourceType);
|
||||
Assert.notNull(sourceType, "Source type must not be null!");
|
||||
return getCustomWriteTarget(sourceType, requestedTargetType) != null;
|
||||
}
|
||||
|
||||
@@ -253,8 +254,8 @@ public class CustomConversions {
|
||||
* @return
|
||||
*/
|
||||
public boolean hasCustomReadTarget(Class<?> sourceType, Class<?> requestedTargetType) {
|
||||
Assert.notNull(sourceType);
|
||||
Assert.notNull(requestedTargetType);
|
||||
Assert.notNull(sourceType, "Source type must not be null!");
|
||||
Assert.notNull(requestedTargetType, "Requested target type must not be null!");
|
||||
return getCustomReadTarget(sourceType, requestedTargetType) != null;
|
||||
}
|
||||
|
||||
@@ -267,7 +268,7 @@ public class CustomConversions {
|
||||
* @return
|
||||
*/
|
||||
private Class<?> getCustomReadTarget(Class<?> sourceType, Class<?> requestedTargetType) {
|
||||
Assert.notNull(sourceType);
|
||||
Assert.notNull(sourceType, "Source type must not be null!");
|
||||
if (requestedTargetType == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -297,8 +298,8 @@ public class CustomConversions {
|
||||
*/
|
||||
private static Class<?> getCustomTarget(Class<?> sourceType, Class<?> requestedTargetType,
|
||||
Iterable<GenericConverter.ConvertiblePair> pairs) {
|
||||
Assert.notNull(sourceType);
|
||||
Assert.notNull(pairs);
|
||||
Assert.notNull(sourceType, "Source type must not be null!");
|
||||
Assert.notNull(pairs, "Pairs must not be null!");
|
||||
|
||||
for (GenericConverter.ConvertiblePair typePair : pairs) {
|
||||
if (typePair.getSourceType().isAssignableFrom(sourceType)) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2015 the original author or authors
|
||||
* Copyright 2012-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.
|
||||
@@ -64,6 +64,7 @@ import org.springframework.util.CollectionUtils;
|
||||
* @author Michael Nitschinger
|
||||
* @author Oliver Gierke
|
||||
* @author Geoffrey Mina
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public class MappingCouchbaseConverter extends AbstractCouchbaseConverter
|
||||
implements ApplicationContextAware {
|
||||
@@ -296,7 +297,7 @@ public class MappingCouchbaseConverter extends AbstractCouchbaseConverter
|
||||
@SuppressWarnings("unchecked")
|
||||
protected Map<Object, Object> readMap(final TypeInformation<?> type, final CouchbaseDocument source,
|
||||
final Object parent) {
|
||||
Assert.notNull(source);
|
||||
Assert.notNull(source, "CouchbaseDocument must not be null!");
|
||||
|
||||
Class<?> mapType = typeMapper.readType(source, type).getType();
|
||||
Map<Object, Object> map = CollectionFactory.createMap(mapType, source.export().keySet().size());
|
||||
@@ -630,7 +631,7 @@ public class MappingCouchbaseConverter extends AbstractCouchbaseConverter
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private Object readCollection(final TypeInformation<?> targetType, final CouchbaseList source, final Object parent) {
|
||||
Assert.notNull(targetType);
|
||||
Assert.notNull(targetType, "Target type must not be null!");
|
||||
|
||||
Class<?> collectionType = targetType.getType();
|
||||
if (source.isEmpty()) {
|
||||
@@ -788,8 +789,8 @@ public class MappingCouchbaseConverter extends AbstractCouchbaseConverter
|
||||
|
||||
public CouchbasePropertyValueProvider(final CouchbaseDocument source,
|
||||
final DefaultSpELExpressionEvaluator evaluator, final Object parent) {
|
||||
Assert.notNull(source);
|
||||
Assert.notNull(evaluator);
|
||||
Assert.notNull(source, "CouchbaseDocument must not be null!");
|
||||
Assert.notNull(evaluator, "DefaultSpELExpressionEvaluator must not be null!");
|
||||
|
||||
this.source = source;
|
||||
this.evaluator = evaluator;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2015 the original author or authors
|
||||
* Copyright 2012-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;
|
||||
*
|
||||
* @author Maciej Walkowiak
|
||||
* @author Michael Nitschinger
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public class ValidatingCouchbaseEventListener extends AbstractCouchbaseEventListener<Object> {
|
||||
|
||||
@@ -46,7 +47,7 @@ public class ValidatingCouchbaseEventListener extends AbstractCouchbaseEventList
|
||||
* @param validator must not be {@literal null}.
|
||||
*/
|
||||
public ValidatingCouchbaseEventListener(Validator validator) {
|
||||
Assert.notNull(validator);
|
||||
Assert.notNull(validator, "Validator must not be null!");
|
||||
this.validator = validator;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2015 the original author or authors
|
||||
* Copyright 2012-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.
|
||||
@@ -31,6 +31,7 @@ import org.springframework.util.Assert;
|
||||
* by repository domain type or as a default fallback.
|
||||
*
|
||||
* @author Simon Baslé
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public class RepositoryOperationsMapping {
|
||||
private CouchbaseOperations defaultOperations;
|
||||
@@ -44,7 +45,7 @@ public class RepositoryOperationsMapping {
|
||||
* @param defaultOperations the default fallback couchbase operations.
|
||||
*/
|
||||
public RepositoryOperationsMapping(CouchbaseOperations defaultOperations) {
|
||||
Assert.notNull(defaultOperations);
|
||||
Assert.notNull(defaultOperations, "CouchbaseOperations must not be null!");
|
||||
this.defaultOperations = defaultOperations;
|
||||
}
|
||||
|
||||
@@ -55,7 +56,7 @@ public class RepositoryOperationsMapping {
|
||||
* @return the mapping, for chaining.
|
||||
*/
|
||||
public RepositoryOperationsMapping setDefault(CouchbaseOperations aDefault) {
|
||||
Assert.notNull(aDefault);
|
||||
Assert.notNull(aDefault, "CouchbaseOperations must not be null!");
|
||||
this.defaultOperations = aDefault;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2015 the original author or authors
|
||||
* Copyright 2012-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.
|
||||
@@ -50,6 +50,7 @@ import org.springframework.util.Assert;
|
||||
*
|
||||
* @author Simon Baslé
|
||||
* @author Subhashni Balakrishnan
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public abstract class AbstractN1qlBasedQuery implements RepositoryQuery {
|
||||
|
||||
@@ -171,7 +172,8 @@ public abstract class AbstractN1qlBasedQuery implements RepositoryQuery {
|
||||
}
|
||||
|
||||
protected Object executePaged(N1qlQuery query, N1qlQuery countQuery, Pageable pageable, Class<?> typeToRead) {
|
||||
Assert.notNull(pageable);
|
||||
Assert.notNull(pageable, "Pageable must not be null!");
|
||||
|
||||
long total = 0L;
|
||||
logIfNecessary(countQuery);
|
||||
List<CountFragment> countResult = couchbaseOperations.findByN1QLProjection(countQuery, CountFragment.class);
|
||||
@@ -185,7 +187,7 @@ public abstract class AbstractN1qlBasedQuery implements RepositoryQuery {
|
||||
}
|
||||
|
||||
protected Object executeSliced(N1qlQuery query, N1qlQuery countQuery, Pageable pageable, Class<?> typeToRead) {
|
||||
Assert.notNull(pageable);
|
||||
Assert.notNull(pageable, "Pageable must not be null!");
|
||||
logIfNecessary(query);
|
||||
List<?> result = couchbaseOperations.findByN1QL(query, typeToRead);
|
||||
int pageSize = pageable.getPageSize();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors
|
||||
* Copyright 2012-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.
|
||||
@@ -41,6 +41,7 @@ import org.springframework.util.Assert;
|
||||
*
|
||||
* @author Simon Baslé
|
||||
* @author Subhashni Balakrishnan
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
|
||||
public class PartTreeN1qlBasedQuery extends AbstractN1qlBasedQuery {
|
||||
@@ -85,11 +86,11 @@ public class PartTreeN1qlBasedQuery extends AbstractN1qlBasedQuery {
|
||||
|
||||
if (queryMethod.isPageQuery()) {
|
||||
Pageable pageable = accessor.getPageable();
|
||||
Assert.notNull(pageable);
|
||||
Assert.notNull(pageable, "Pageable must not be null!");
|
||||
return selectFromWhereOrderBy.limit(pageable.getPageSize()).offset(pageable.getOffset());
|
||||
} else if (queryMethod.isSliceQuery() && accessor.getPageable() != null) {
|
||||
Pageable pageable = accessor.getPageable();
|
||||
Assert.notNull(pageable);
|
||||
Assert.notNull(pageable, "Pageable must not be null!");
|
||||
return selectFromWhereOrderBy.limit(pageable.getPageSize() + 1).offset(pageable.getOffset());
|
||||
} else if (partTree.isLimiting()) {
|
||||
return selectFromWhereOrderBy.limit(partTree.getMaxResults());
|
||||
|
||||
@@ -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.
|
||||
@@ -57,6 +57,7 @@ import org.springframework.util.Assert;
|
||||
* @author Michael Nitschinger
|
||||
* @author Simon Baslé
|
||||
* @author Oliver Gierke
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public class CouchbaseRepositoryFactory extends RepositoryFactorySupport {
|
||||
|
||||
@@ -88,8 +89,8 @@ public class CouchbaseRepositoryFactory extends RepositoryFactorySupport {
|
||||
* @param couchbaseOperationsMapping the template for the underlying actions.
|
||||
*/
|
||||
public CouchbaseRepositoryFactory(final RepositoryOperationsMapping couchbaseOperationsMapping, final IndexManager indexManager) {
|
||||
Assert.notNull(couchbaseOperationsMapping);
|
||||
Assert.notNull(indexManager);
|
||||
Assert.notNull(couchbaseOperationsMapping, "RepositoryOperationsMapping must not be null!");
|
||||
Assert.notNull(indexManager, "IndexManager must not be null!");
|
||||
|
||||
this.couchbaseOperationsMapping = couchbaseOperationsMapping;
|
||||
this.indexManager = indexManager;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2015 the original author or authors
|
||||
* Copyright 2012-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.
|
||||
@@ -44,6 +44,8 @@ import org.springframework.util.Assert;
|
||||
/**
|
||||
* A {@link CouchbasePagingAndSortingRepository} implementation. It uses N1QL for its {@link PagingAndSortingRepository}
|
||||
* method implementation.
|
||||
*
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public class N1qlCouchbaseRepository<T, ID extends Serializable>
|
||||
extends SimpleCouchbaseRepository<T, ID>
|
||||
@@ -61,7 +63,7 @@ public class N1qlCouchbaseRepository<T, ID extends Serializable>
|
||||
|
||||
@Override
|
||||
public Iterable<T> findAll(Sort sort) {
|
||||
Assert.notNull(sort);
|
||||
Assert.notNull(sort, "Sort must not be null!");
|
||||
|
||||
//prepare elements of the query
|
||||
WherePath selectFrom = N1qlUtils.createSelectFromForEntity(getCouchbaseOperations().getCouchbaseBucket().name());
|
||||
@@ -80,7 +82,7 @@ public class N1qlCouchbaseRepository<T, ID extends Serializable>
|
||||
|
||||
@Override
|
||||
public Page<T> findAll(Pageable pageable) {
|
||||
Assert.notNull(pageable);
|
||||
Assert.notNull(pageable, "Pageable must not be null");
|
||||
ScanConsistency consistency = getCouchbaseOperations().getDefaultConsistency().n1qlConsistency();
|
||||
|
||||
//prepare the count total query
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013 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.
|
||||
@@ -38,6 +38,7 @@ import org.springframework.util.StringUtils;
|
||||
* Repository base implementation for Couchbase.
|
||||
*
|
||||
* @author Michael Nitschinger
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public class SimpleCouchbaseRepository<T, ID extends Serializable> implements CouchbaseRepository<T, ID> {
|
||||
|
||||
@@ -63,8 +64,8 @@ public class SimpleCouchbaseRepository<T, ID extends Serializable> implements Co
|
||||
* @param couchbaseOperations the reference to the template used.
|
||||
*/
|
||||
public SimpleCouchbaseRepository(final CouchbaseEntityInformation<T, String> metadata, final CouchbaseOperations couchbaseOperations) {
|
||||
Assert.notNull(couchbaseOperations);
|
||||
Assert.notNull(metadata);
|
||||
Assert.notNull(metadata, "CouchbaseEntityInformation must not be null!");
|
||||
Assert.notNull(couchbaseOperations, "CouchbaseOperations must not be null!");
|
||||
|
||||
entityInformation = metadata;
|
||||
this.couchbaseOperations = couchbaseOperations;
|
||||
|
||||
Reference in New Issue
Block a user