@@ -56,7 +56,7 @@ enum DefaultIdentifierGenerator implements IdentifierGenerator {
|
||||
}
|
||||
|
||||
throw new InvalidDataAccessApiUsageException(
|
||||
String.format("Identifier cannot be generated for %s. Supported types are: UUID, String, Integer, and Long.",
|
||||
String.format("Identifier cannot be generated for %s; Supported types are: UUID, String, Integer, and Long",
|
||||
identifierType.getType().getName()));
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ enum DefaultIdentifierGenerator implements IdentifierGenerator {
|
||||
|
||||
if (secureRandom == null) {
|
||||
throw new InvalidDataAccessApiUsageException(
|
||||
String.format("Could not create SecureRandom instance for one of the algorithms '%s'.",
|
||||
String.format("Could not create SecureRandom instance for one of the algorithms '%s'",
|
||||
StringUtils.collectionToCommaDelimitedString(OsTools.secureRandomAlgorithmNames())));
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ public class ForwardingCloseableIterator<T> implements CloseableIterator<T> {
|
||||
*/
|
||||
public ForwardingCloseableIterator(Iterator<? extends T> delegate, @Nullable Runnable closeHandler) {
|
||||
|
||||
Assert.notNull(delegate, "Delegate iterator must not be null!");
|
||||
Assert.notNull(delegate, "Delegate iterator must not be null");
|
||||
|
||||
this.delegate = delegate;
|
||||
this.closeHandler = closeHandler;
|
||||
|
||||
@@ -45,9 +45,9 @@ class GeneratingIdAccessor implements IdentifierAccessor {
|
||||
GeneratingIdAccessor(PersistentPropertyAccessor<?> accessor, PersistentProperty<?> identifierProperty,
|
||||
IdentifierGenerator generator) {
|
||||
|
||||
Assert.notNull(accessor, "PersistentPropertyAccessor must not be null!");
|
||||
Assert.notNull(identifierProperty, "Identifier property must not be null!");
|
||||
Assert.notNull(generator, "IdentifierGenerator must not be null!");
|
||||
Assert.notNull(accessor, "PersistentPropertyAccessor must not be null");
|
||||
Assert.notNull(identifierProperty, "Identifier property must not be null");
|
||||
Assert.notNull(generator, "IdentifierGenerator must not be null");
|
||||
|
||||
this.accessor = accessor;
|
||||
this.identifierProperty = identifierProperty;
|
||||
|
||||
@@ -36,7 +36,7 @@ public class KeyValuePersistenceExceptionTranslator implements PersistenceExcept
|
||||
@Override
|
||||
public DataAccessException translateExceptionIfPossible(RuntimeException exception) {
|
||||
|
||||
Assert.notNull(exception, "Exception must not be null!");
|
||||
Assert.notNull(exception, "Exception must not be null");
|
||||
|
||||
if (exception instanceof DataAccessException) {
|
||||
return (DataAccessException) exception;
|
||||
|
||||
@@ -96,9 +96,9 @@ public class KeyValueTemplate implements KeyValueOperations, ApplicationEventPub
|
||||
MappingContext<? extends KeyValuePersistentEntity<?, ?>, ? extends KeyValuePersistentProperty<?>> mappingContext,
|
||||
IdentifierGenerator identifierGenerator) {
|
||||
|
||||
Assert.notNull(adapter, "Adapter must not be null!");
|
||||
Assert.notNull(mappingContext, "MappingContext must not be null!");
|
||||
Assert.notNull(identifierGenerator, "IdentifierGenerator must not be null!");
|
||||
Assert.notNull(adapter, "Adapter must not be null");
|
||||
Assert.notNull(mappingContext, "MappingContext must not be null");
|
||||
Assert.notNull(identifierGenerator, "IdentifierGenerator must not be null");
|
||||
|
||||
this.adapter = adapter;
|
||||
this.mappingContext = mappingContext;
|
||||
@@ -112,7 +112,7 @@ public class KeyValueTemplate implements KeyValueOperations, ApplicationEventPub
|
||||
*/
|
||||
public void setExceptionTranslator(PersistenceExceptionTranslator exceptionTranslator) {
|
||||
|
||||
Assert.notNull(exceptionTranslator, "ExceptionTranslator must not be null!");
|
||||
Assert.notNull(exceptionTranslator, "ExceptionTranslator must not be null");
|
||||
this.exceptionTranslator = exceptionTranslator;
|
||||
}
|
||||
|
||||
@@ -152,8 +152,8 @@ public class KeyValueTemplate implements KeyValueOperations, ApplicationEventPub
|
||||
@Override
|
||||
public <T> T insert(Object id, T objectToInsert) {
|
||||
|
||||
Assert.notNull(id, "Id for object to be inserted must not be null!");
|
||||
Assert.notNull(objectToInsert, "Object to be inserted must not be null!");
|
||||
Assert.notNull(id, "Id for object to be inserted must not be null");
|
||||
Assert.notNull(objectToInsert, "Object to be inserted must not be null");
|
||||
|
||||
String keyspace = resolveKeySpace(objectToInsert.getClass());
|
||||
|
||||
@@ -163,7 +163,7 @@ public class KeyValueTemplate implements KeyValueOperations, ApplicationEventPub
|
||||
|
||||
if (adapter.contains(id, keyspace)) {
|
||||
throw new DuplicateKeyException(
|
||||
String.format("Cannot insert existing object with id %s!. Please use update.", id));
|
||||
String.format("Cannot insert existing object with id %s; Please use update", id));
|
||||
}
|
||||
|
||||
adapter.put(id, objectToInsert, keyspace);
|
||||
@@ -191,8 +191,8 @@ public class KeyValueTemplate implements KeyValueOperations, ApplicationEventPub
|
||||
@Override
|
||||
public <T> T update(Object id, T objectToUpdate) {
|
||||
|
||||
Assert.notNull(id, "Id for object to be inserted must not be null!");
|
||||
Assert.notNull(objectToUpdate, "Object to be updated must not be null!");
|
||||
Assert.notNull(id, "Id for object to be inserted must not be null");
|
||||
Assert.notNull(objectToUpdate, "Object to be updated must not be null");
|
||||
|
||||
String keyspace = resolveKeySpace(objectToUpdate.getClass());
|
||||
|
||||
@@ -209,7 +209,7 @@ public class KeyValueTemplate implements KeyValueOperations, ApplicationEventPub
|
||||
@Override
|
||||
public <T> Iterable<T> findAll(Class<T> type) {
|
||||
|
||||
Assert.notNull(type, "Type to fetch must not be null!");
|
||||
Assert.notNull(type, "Type to fetch must not be null");
|
||||
|
||||
return executeRequired(adapter -> {
|
||||
|
||||
@@ -229,8 +229,8 @@ public class KeyValueTemplate implements KeyValueOperations, ApplicationEventPub
|
||||
@Override
|
||||
public <T> Optional<T> findById(Object id, Class<T> type) {
|
||||
|
||||
Assert.notNull(id, "Id for object to be found must not be null!");
|
||||
Assert.notNull(type, "Type to fetch must not be null!");
|
||||
Assert.notNull(id, "Id for object to be found must not be null");
|
||||
Assert.notNull(type, "Type to fetch must not be null");
|
||||
|
||||
String keyspace = resolveKeySpace(type);
|
||||
|
||||
@@ -255,7 +255,7 @@ public class KeyValueTemplate implements KeyValueOperations, ApplicationEventPub
|
||||
@Override
|
||||
public void delete(Class<?> type) {
|
||||
|
||||
Assert.notNull(type, "Type to delete must not be null!");
|
||||
Assert.notNull(type, "Type to delete must not be null");
|
||||
|
||||
String keyspace = resolveKeySpace(type);
|
||||
|
||||
@@ -283,8 +283,8 @@ public class KeyValueTemplate implements KeyValueOperations, ApplicationEventPub
|
||||
@Override
|
||||
public <T> T delete(Object id, Class<T> type) {
|
||||
|
||||
Assert.notNull(id, "Id for object to be deleted must not be null!");
|
||||
Assert.notNull(type, "Type to delete must not be null!");
|
||||
Assert.notNull(id, "Id for object to be deleted must not be null");
|
||||
Assert.notNull(type, "Type to delete must not be null");
|
||||
|
||||
String keyspace = resolveKeySpace(type);
|
||||
|
||||
@@ -300,7 +300,7 @@ public class KeyValueTemplate implements KeyValueOperations, ApplicationEventPub
|
||||
@Override
|
||||
public long count(Class<?> type) {
|
||||
|
||||
Assert.notNull(type, "Type for count must not be null!");
|
||||
Assert.notNull(type, "Type for count must not be null");
|
||||
return adapter.count(resolveKeySpace(type));
|
||||
}
|
||||
|
||||
@@ -308,7 +308,7 @@ public class KeyValueTemplate implements KeyValueOperations, ApplicationEventPub
|
||||
@Override
|
||||
public <T> T execute(KeyValueCallback<T> action) {
|
||||
|
||||
Assert.notNull(action, "KeyValueCallback must not be null!");
|
||||
Assert.notNull(action, "KeyValueCallback must not be null");
|
||||
|
||||
try {
|
||||
return action.doInKeyValue(this.adapter);
|
||||
@@ -332,7 +332,7 @@ public class KeyValueTemplate implements KeyValueOperations, ApplicationEventPub
|
||||
return result;
|
||||
}
|
||||
|
||||
throw new IllegalStateException(String.format("KeyValueCallback %s returned null value!", action));
|
||||
throw new IllegalStateException(String.format("KeyValueCallback %s returned null value", action));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -144,7 +144,7 @@ public abstract class QueryEngine<ADAPTER extends KeyValueAdapter, CRITERIA, SOR
|
||||
return adapter;
|
||||
}
|
||||
|
||||
throw new IllegalStateException("Required KeyValueAdapter is not set!");
|
||||
throw new IllegalStateException("Required KeyValueAdapter is not set");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -156,7 +156,7 @@ public abstract class QueryEngine<ADAPTER extends KeyValueAdapter, CRITERIA, SOR
|
||||
if (this.adapter == null) {
|
||||
this.adapter = (ADAPTER) adapter;
|
||||
} else {
|
||||
throw new IllegalArgumentException("Cannot register more than one adapter for this QueryEngine.");
|
||||
throw new IllegalArgumentException("Cannot register more than one adapter for this QueryEngine");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,8 +49,8 @@ public class SpelCriteria {
|
||||
*/
|
||||
public SpelCriteria(SpelExpression expression, EvaluationContext context) {
|
||||
|
||||
Assert.notNull(expression, "SpEL expression must not be null!");
|
||||
Assert.notNull(context, "EvaluationContext must not be null!");
|
||||
Assert.notNull(expression, "SpEL expression must not be null");
|
||||
Assert.notNull(context, "EvaluationContext must not be null");
|
||||
|
||||
this.expression = expression;
|
||||
this.context = context;
|
||||
|
||||
@@ -37,7 +37,7 @@ class SpelCriteriaAccessor implements CriteriaAccessor<SpelCriteria> {
|
||||
*/
|
||||
public SpelCriteriaAccessor(SpelExpressionParser parser) {
|
||||
|
||||
Assert.notNull(parser, "SpelExpressionParser must not be null!");
|
||||
Assert.notNull(parser, "SpelExpressionParser must not be null");
|
||||
|
||||
this.parser = parser;
|
||||
}
|
||||
|
||||
@@ -47,8 +47,8 @@ public class SpelPropertyComparator<T> implements Comparator<T> {
|
||||
*/
|
||||
public SpelPropertyComparator(String path, SpelExpressionParser parser) {
|
||||
|
||||
Assert.hasText(path, "Path must not be null or empty!");
|
||||
Assert.notNull(parser, "SpelExpressionParser must not be null!");
|
||||
Assert.hasText(path, "Path must not be null or empty");
|
||||
Assert.notNull(parser, "SpelExpressionParser must not be null");
|
||||
|
||||
this.path = path;
|
||||
this.parser = parser;
|
||||
|
||||
@@ -43,7 +43,7 @@ public class SpelSortAccessor implements SortAccessor<Comparator<?>> {
|
||||
*/
|
||||
public SpelSortAccessor(SpelExpressionParser parser) {
|
||||
|
||||
Assert.notNull(parser, "SpelExpressionParser must not be null!");
|
||||
Assert.notNull(parser, "SpelExpressionParser must not be null");
|
||||
this.parser = parser;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ enum AnnotationBasedKeySpaceResolver implements KeySpaceResolver {
|
||||
@Nullable
|
||||
public String resolveKeySpace(Class<?> type) {
|
||||
|
||||
Assert.notNull(type, "Type for keyspace for null!");
|
||||
Assert.notNull(type, "Type for keyspace for null");
|
||||
|
||||
Class<?> userClass = ClassUtils.getUserClass(type);
|
||||
Object keySpace = getKeySpace(userClass);
|
||||
|
||||
@@ -31,7 +31,7 @@ enum ClassNameKeySpaceResolver implements KeySpaceResolver {
|
||||
@Override
|
||||
public String resolveKeySpace(Class<?> type) {
|
||||
|
||||
Assert.notNull(type, "Type must not be null!");
|
||||
Assert.notNull(type, "Type must not be null");
|
||||
return ClassUtils.getUserClass(type).getName();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ public class KeyValueQuery<T> {
|
||||
*/
|
||||
public void setSort(Sort sort) {
|
||||
|
||||
Assert.notNull(sort, "Sort must not be null!");
|
||||
Assert.notNull(sort, "Sort must not be null");
|
||||
|
||||
this.sort = sort;
|
||||
}
|
||||
@@ -146,7 +146,7 @@ public class KeyValueQuery<T> {
|
||||
*/
|
||||
public KeyValueQuery<T> orderBy(Sort sort) {
|
||||
|
||||
Assert.notNull(sort, "Sort must not be null!");
|
||||
Assert.notNull(sort, "Sort must not be null");
|
||||
|
||||
if (this.sort.isSorted()) {
|
||||
this.sort = this.sort.and(sort);
|
||||
|
||||
@@ -88,10 +88,10 @@ public class KeyValuePartTreeQuery implements RepositoryQuery {
|
||||
KeyValueOperations keyValueOperations,
|
||||
QueryCreatorFactory<AbstractQueryCreator<KeyValueQuery<?>, ?>> queryCreatorFactory) {
|
||||
|
||||
Assert.notNull(queryMethod, "Query method must not be null!");
|
||||
Assert.notNull(evaluationContextProvider, "EvaluationContextprovider must not be null!");
|
||||
Assert.notNull(keyValueOperations, "KeyValueOperations must not be null!");
|
||||
Assert.notNull(queryCreatorFactory, "QueryCreatorFactory type must not be null!");
|
||||
Assert.notNull(queryMethod, "Query method must not be null");
|
||||
Assert.notNull(evaluationContextProvider, "EvaluationContextprovider must not be null");
|
||||
Assert.notNull(keyValueOperations, "KeyValueOperations must not be null");
|
||||
Assert.notNull(queryCreatorFactory, "QueryCreatorFactory type must not be null");
|
||||
|
||||
this.partTree = Lazy
|
||||
.of(() -> new PartTree(queryMethod.getName(), queryMethod.getEntityInformation().getJavaType()));
|
||||
@@ -142,7 +142,7 @@ public class KeyValuePartTreeQuery implements RepositoryQuery {
|
||||
return keyValueOperations.exists(query, queryMethod.getEntityInformation().getJavaType());
|
||||
}
|
||||
|
||||
throw new UnsupportedOperationException("Query method not supported.");
|
||||
throw new UnsupportedOperationException("Query method not supported");
|
||||
}
|
||||
|
||||
protected KeyValueQuery<?> prepareQuery(Object[] parameters) {
|
||||
@@ -258,7 +258,7 @@ public class KeyValuePartTreeQuery implements RepositoryQuery {
|
||||
public AbstractQueryCreator<KeyValueQuery<?>, ?> queryCreatorFor(PartTree partTree, ParameterAccessor accessor) {
|
||||
|
||||
Assert.state(constructor != null,
|
||||
() -> String.format("No constructor (PartTree, ParameterAccessor) could be found on type %s!", type));
|
||||
() -> String.format("No constructor (PartTree, ParameterAccessor) could be found on type %s", type));
|
||||
return (AbstractQueryCreator<KeyValueQuery<?>, ?>) BeanUtils.instantiateClass(constructor, partTree, accessor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ public class SpelQueryCreator extends AbstractQueryCreator<KeyValueQuery<SpelExp
|
||||
|
||||
// TODO: check if we can have caseinsensitive search
|
||||
if (!part.shouldIgnoreCase().equals(IgnoreCaseType.NEVER)) {
|
||||
throw new InvalidDataAccessApiUsageException("Ignore case not supported!");
|
||||
throw new InvalidDataAccessApiUsageException("Ignore case not supported");
|
||||
}
|
||||
|
||||
switch (part.getType()) {
|
||||
|
||||
@@ -54,8 +54,8 @@ abstract class KeyValueQuerydslUtils {
|
||||
*/
|
||||
static OrderSpecifier<?>[] toOrderSpecifier(Sort sort, PathBuilder<?> builder) {
|
||||
|
||||
Assert.notNull(sort, "Sort must not be null!");
|
||||
Assert.notNull(builder, "Builder must not be null!");
|
||||
Assert.notNull(sort, "Sort must not be null");
|
||||
Assert.notNull(builder, "Builder must not be null");
|
||||
|
||||
List<OrderSpecifier<?>> specifiers = null;
|
||||
|
||||
@@ -88,8 +88,8 @@ abstract class KeyValueQuerydslUtils {
|
||||
*/
|
||||
private static Expression<?> buildOrderPropertyPathFrom(Order order, PathBuilder<?> builder) {
|
||||
|
||||
Assert.notNull(order, "Order must not be null!");
|
||||
Assert.notNull(builder, "Builder must not be null!");
|
||||
Assert.notNull(order, "Order must not be null");
|
||||
Assert.notNull(builder, "Builder must not be null");
|
||||
|
||||
PropertyPath path = PropertyPath.from(order.getProperty(), builder.getType());
|
||||
Expression<?> sortPropertyExpression = builder;
|
||||
@@ -118,7 +118,7 @@ abstract class KeyValueQuerydslUtils {
|
||||
*/
|
||||
private static NullHandling toQueryDslNullHandling(org.springframework.data.domain.Sort.NullHandling nullHandling) {
|
||||
|
||||
Assert.notNull(nullHandling, "NullHandling must not be null!");
|
||||
Assert.notNull(nullHandling, "NullHandling must not be null");
|
||||
|
||||
switch (nullHandling) {
|
||||
|
||||
|
||||
@@ -99,9 +99,9 @@ public class KeyValueRepositoryFactory extends RepositoryFactorySupport {
|
||||
public KeyValueRepositoryFactory(KeyValueOperations keyValueOperations,
|
||||
Class<? extends AbstractQueryCreator<?, ?>> queryCreator, Class<? extends RepositoryQuery> repositoryQueryType) {
|
||||
|
||||
Assert.notNull(keyValueOperations, "KeyValueOperations must not be null!");
|
||||
Assert.notNull(queryCreator, "Query creator type must not be null!");
|
||||
Assert.notNull(repositoryQueryType, "RepositoryQueryType type must not be null!");
|
||||
Assert.notNull(keyValueOperations, "KeyValueOperations must not be null");
|
||||
Assert.notNull(queryCreator, "Query creator type must not be null");
|
||||
Assert.notNull(repositoryQueryType, "RepositoryQueryType type must not be null");
|
||||
|
||||
this.queryCreator = queryCreator;
|
||||
this.keyValueOperations = keyValueOperations;
|
||||
@@ -204,10 +204,10 @@ public class KeyValueRepositoryFactory extends RepositoryFactorySupport {
|
||||
Class<? extends AbstractQueryCreator<?, ?>> queryCreator,
|
||||
Class<? extends RepositoryQuery> repositoryQueryType) {
|
||||
|
||||
Assert.notNull(evaluationContextProvider, "EvaluationContextProvider must not be null!");
|
||||
Assert.notNull(keyValueOperations, "KeyValueOperations must not be null!");
|
||||
Assert.notNull(queryCreator, "Query creator type must not be null!");
|
||||
Assert.notNull(repositoryQueryType, "RepositoryQueryType type must not be null!");
|
||||
Assert.notNull(evaluationContextProvider, "EvaluationContextProvider must not be null");
|
||||
Assert.notNull(keyValueOperations, "KeyValueOperations must not be null");
|
||||
Assert.notNull(queryCreator, "Query creator type must not be null");
|
||||
Assert.notNull(repositoryQueryType, "RepositoryQueryType type must not be null");
|
||||
|
||||
this.evaluationContextProvider = evaluationContextProvider;
|
||||
this.keyValueOperations = keyValueOperations;
|
||||
@@ -228,7 +228,7 @@ public class KeyValueRepositoryFactory extends RepositoryFactorySupport {
|
||||
|
||||
Assert.state(constructor != null,
|
||||
String.format(
|
||||
"Constructor %s(QueryMethod, EvaluationContextProvider, KeyValueOperations, Class) not available!",
|
||||
"Constructor %s(QueryMethod, EvaluationContextProvider, KeyValueOperations, Class) not available",
|
||||
ClassUtils.getShortName(this.repositoryQueryType)));
|
||||
|
||||
return BeanUtils.instantiateClass(constructor, queryMethod, evaluationContextProvider, this.keyValueOperations,
|
||||
|
||||
@@ -57,7 +57,7 @@ public class KeyValueRepositoryFactoryBean<T extends Repository<S, ID>, S, ID>
|
||||
*/
|
||||
public void setKeyValueOperations(KeyValueOperations operations) {
|
||||
|
||||
Assert.notNull(operations, "KeyValueOperations must not be null!");
|
||||
Assert.notNull(operations, "KeyValueOperations must not be null");
|
||||
|
||||
this.operations = operations;
|
||||
}
|
||||
@@ -74,7 +74,7 @@ public class KeyValueRepositoryFactoryBean<T extends Repository<S, ID>, S, ID>
|
||||
*/
|
||||
public void setQueryCreator(Class<? extends AbstractQueryCreator<?, ?>> queryCreator) {
|
||||
|
||||
Assert.notNull(queryCreator, "Query creator type must not be null!");
|
||||
Assert.notNull(queryCreator, "Query creator type must not be null");
|
||||
|
||||
this.queryCreator = queryCreator;
|
||||
}
|
||||
@@ -87,7 +87,7 @@ public class KeyValueRepositoryFactoryBean<T extends Repository<S, ID>, S, ID>
|
||||
*/
|
||||
public void setQueryType(Class<? extends RepositoryQuery> repositoryQueryType) {
|
||||
|
||||
Assert.notNull(queryCreator, "Query creator type must not be null!");
|
||||
Assert.notNull(queryCreator, "Query creator type must not be null");
|
||||
|
||||
this.repositoryQueryType = repositoryQueryType;
|
||||
|
||||
@@ -116,9 +116,9 @@ public class KeyValueRepositoryFactoryBean<T extends Repository<S, ID>, S, ID>
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
|
||||
Assert.notNull(operations, "KeyValueOperations must not be null!");
|
||||
Assert.notNull(queryCreator, "Query creator type must not be null!");
|
||||
Assert.notNull(repositoryQueryType, "RepositoryQueryType type type must not be null!");
|
||||
Assert.notNull(operations, "KeyValueOperations must not be null");
|
||||
Assert.notNull(queryCreator, "Query creator type must not be null");
|
||||
Assert.notNull(repositoryQueryType, "RepositoryQueryType type type must not be null");
|
||||
|
||||
super.afterPropertiesSet();
|
||||
}
|
||||
|
||||
@@ -98,10 +98,10 @@ public class QuerydslKeyValuePredicateExecutor<T> implements ListQuerydslPredica
|
||||
ProjectionFactory projectionFactory, KeyValueOperations operations,
|
||||
EntityPathResolver resolver) {
|
||||
|
||||
Assert.notNull(entityInformation, "EntityInformation must not be null!");
|
||||
Assert.notNull(projectionFactory, "ProjectionFactory must not be null!");
|
||||
Assert.notNull(operations, "KeyValueOperations must not be null!");
|
||||
Assert.notNull(resolver, "EntityPathResolver must not be null!");
|
||||
Assert.notNull(entityInformation, "EntityInformation must not be null");
|
||||
Assert.notNull(projectionFactory, "ProjectionFactory must not be null");
|
||||
Assert.notNull(operations, "KeyValueOperations must not be null");
|
||||
Assert.notNull(resolver, "EntityPathResolver must not be null");
|
||||
|
||||
this.projectionFactory = projectionFactory;
|
||||
this.context = operations.getMappingContext();
|
||||
@@ -114,19 +114,19 @@ public class QuerydslKeyValuePredicateExecutor<T> implements ListQuerydslPredica
|
||||
@Override
|
||||
public Optional<T> findOne(Predicate predicate) {
|
||||
|
||||
Assert.notNull(predicate, "Predicate must not be null!");
|
||||
Assert.notNull(predicate, "Predicate must not be null");
|
||||
|
||||
try {
|
||||
return Optional.ofNullable(prepareQuery(predicate).fetchOne());
|
||||
} catch (NonUniqueResultException o_O) {
|
||||
throw new IncorrectResultSizeDataAccessException("Expected one or no result but found more than one!", 1, o_O);
|
||||
throw new IncorrectResultSizeDataAccessException("Expected one or no result but found more than one", 1, o_O);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<T> findAll(Predicate predicate) {
|
||||
|
||||
Assert.notNull(predicate, "Predicate must not be null!");
|
||||
Assert.notNull(predicate, "Predicate must not be null");
|
||||
|
||||
return prepareQuery(predicate).fetchResults().getResults();
|
||||
}
|
||||
@@ -134,8 +134,8 @@ public class QuerydslKeyValuePredicateExecutor<T> implements ListQuerydslPredica
|
||||
@Override
|
||||
public List<T> findAll(Predicate predicate, OrderSpecifier<?>... orders) {
|
||||
|
||||
Assert.notNull(predicate, "Predicate must not be null!");
|
||||
Assert.notNull(orders, "OrderSpecifiers must not be null!");
|
||||
Assert.notNull(predicate, "Predicate must not be null");
|
||||
Assert.notNull(orders, "OrderSpecifiers must not be null");
|
||||
|
||||
AbstractCollQuery<T, ?> query = prepareQuery(predicate);
|
||||
query.orderBy(orders);
|
||||
@@ -146,8 +146,8 @@ public class QuerydslKeyValuePredicateExecutor<T> implements ListQuerydslPredica
|
||||
@Override
|
||||
public List<T> findAll(Predicate predicate, Sort sort) {
|
||||
|
||||
Assert.notNull(predicate, "Predicate must not be null!");
|
||||
Assert.notNull(sort, "Sort must not be null!");
|
||||
Assert.notNull(predicate, "Predicate must not be null");
|
||||
Assert.notNull(sort, "Sort must not be null");
|
||||
|
||||
return findAll(predicate, toOrderSpecifier(sort, builder));
|
||||
}
|
||||
@@ -155,8 +155,8 @@ public class QuerydslKeyValuePredicateExecutor<T> implements ListQuerydslPredica
|
||||
@Override
|
||||
public Page<T> findAll(Predicate predicate, Pageable pageable) {
|
||||
|
||||
Assert.notNull(predicate, "Predicate must not be null!");
|
||||
Assert.notNull(pageable, "Pageable must not be null!");
|
||||
Assert.notNull(predicate, "Predicate must not be null");
|
||||
Assert.notNull(pageable, "Pageable must not be null");
|
||||
|
||||
AbstractCollQuery<T, ?> query = prepareQuery(predicate);
|
||||
|
||||
@@ -176,7 +176,7 @@ public class QuerydslKeyValuePredicateExecutor<T> implements ListQuerydslPredica
|
||||
@Override
|
||||
public List<T> findAll(OrderSpecifier<?>... orders) {
|
||||
|
||||
Assert.notNull(orders, "OrderSpecifiers must not be null!");
|
||||
Assert.notNull(orders, "OrderSpecifiers must not be null");
|
||||
|
||||
if (orders.length == 0) {
|
||||
return findAll.get();
|
||||
@@ -191,7 +191,7 @@ public class QuerydslKeyValuePredicateExecutor<T> implements ListQuerydslPredica
|
||||
@Override
|
||||
public long count(Predicate predicate) {
|
||||
|
||||
Assert.notNull(predicate, "Predicate must not be null!");
|
||||
Assert.notNull(predicate, "Predicate must not be null");
|
||||
|
||||
return prepareQuery(predicate).fetchCount();
|
||||
}
|
||||
@@ -199,7 +199,7 @@ public class QuerydslKeyValuePredicateExecutor<T> implements ListQuerydslPredica
|
||||
@Override
|
||||
public boolean exists(Predicate predicate) {
|
||||
|
||||
Assert.notNull(predicate, "Predicate must not be null!");
|
||||
Assert.notNull(predicate, "Predicate must not be null");
|
||||
|
||||
return count(predicate) > 0;
|
||||
}
|
||||
@@ -209,8 +209,8 @@ public class QuerydslKeyValuePredicateExecutor<T> implements ListQuerydslPredica
|
||||
public <S extends T, R> R findBy(Predicate predicate,
|
||||
Function<FluentQuery.FetchableFluentQuery<S>, R> queryFunction) {
|
||||
|
||||
Assert.notNull(predicate, "Predicate must not be null!");
|
||||
Assert.notNull(queryFunction, "Query function must not be null!");
|
||||
Assert.notNull(predicate, "Predicate must not be null");
|
||||
Assert.notNull(queryFunction, "Query function must not be null");
|
||||
|
||||
return queryFunction.apply(new FluentQuerydsl<>(predicate, (Class<S>) entityInformation.getJavaType()));
|
||||
}
|
||||
@@ -260,7 +260,7 @@ public class QuerydslKeyValuePredicateExecutor<T> implements ListQuerydslPredica
|
||||
@Override
|
||||
public FluentQuery.FetchableFluentQuery<R> sortBy(Sort sort) {
|
||||
|
||||
Assert.notNull(sort, "Sort must not be null!");
|
||||
Assert.notNull(sort, "Sort must not be null");
|
||||
|
||||
return new FluentQuerydsl<>(predicate, sort, entityType, resultType, fieldsToInclude);
|
||||
}
|
||||
@@ -268,14 +268,14 @@ public class QuerydslKeyValuePredicateExecutor<T> implements ListQuerydslPredica
|
||||
@Override
|
||||
public <NR> FluentQuery.FetchableFluentQuery<NR> as(Class<NR> projection) {
|
||||
|
||||
Assert.notNull(projection, "Projection target type must not be null!");
|
||||
Assert.notNull(projection, "Projection target type must not be null");
|
||||
|
||||
return new FluentQuerydsl<>(predicate, sort, entityType, projection, fieldsToInclude);
|
||||
}
|
||||
|
||||
public FluentQuery.FetchableFluentQuery<R> project(Collection<String> properties) {
|
||||
|
||||
Assert.notNull(properties, "Projection properties must not be null!");
|
||||
Assert.notNull(properties, "Projection properties must not be null");
|
||||
|
||||
return new FluentQuerydsl<>(predicate, sort, entityType, resultType, new ArrayList<>(properties));
|
||||
}
|
||||
@@ -322,7 +322,7 @@ public class QuerydslKeyValuePredicateExecutor<T> implements ListQuerydslPredica
|
||||
@Override
|
||||
public Page<R> page(Pageable pageable) {
|
||||
|
||||
Assert.notNull(pageable, "Pageable must not be null!");
|
||||
Assert.notNull(pageable, "Pageable must not be null");
|
||||
|
||||
AbstractCollQuery<T, ?> query = createQuery();
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ public class QuerydslKeyValueRepository<T, ID> extends SimpleKeyValueRepository<
|
||||
|
||||
super(entityInformation, operations);
|
||||
|
||||
Assert.notNull(resolver, "EntityPathResolver must not be null!");
|
||||
Assert.notNull(resolver, "EntityPathResolver must not be null");
|
||||
|
||||
this.executor = new QuerydslKeyValuePredicateExecutor<>(entityInformation, new SpelAwareProxyProjectionFactory(),
|
||||
operations, resolver);
|
||||
|
||||
@@ -53,8 +53,8 @@ public class SimpleKeyValueRepository<T, ID> implements KeyValueRepository<T, ID
|
||||
*/
|
||||
public SimpleKeyValueRepository(EntityInformation<T, ID> metadata, KeyValueOperations operations) {
|
||||
|
||||
Assert.notNull(metadata, "EntityInformation must not be null!");
|
||||
Assert.notNull(operations, "KeyValueOperations must not be null!");
|
||||
Assert.notNull(metadata, "EntityInformation must not be null");
|
||||
Assert.notNull(operations, "KeyValueOperations must not be null");
|
||||
|
||||
this.entityInformation = metadata;
|
||||
this.operations = operations;
|
||||
@@ -67,7 +67,7 @@ public class SimpleKeyValueRepository<T, ID> implements KeyValueRepository<T, ID
|
||||
@Override
|
||||
public <S extends T> S save(S entity) {
|
||||
|
||||
Assert.notNull(entity, "Entity must not be null!");
|
||||
Assert.notNull(entity, "Entity must not be null");
|
||||
|
||||
if (entityInformation.isNew(entity)) {
|
||||
return operations.insert(entity);
|
||||
@@ -79,7 +79,7 @@ public class SimpleKeyValueRepository<T, ID> implements KeyValueRepository<T, ID
|
||||
@Override
|
||||
public <S extends T> List<S> saveAll(Iterable<S> entities) {
|
||||
|
||||
Assert.notNull(entities, "The given Iterable of entities must not be null!");
|
||||
Assert.notNull(entities, "The given Iterable of entities must not be null");
|
||||
|
||||
List<S> saved = new ArrayList<>();
|
||||
|
||||
@@ -93,7 +93,7 @@ public class SimpleKeyValueRepository<T, ID> implements KeyValueRepository<T, ID
|
||||
@Override
|
||||
public Optional<T> findById(ID id) {
|
||||
|
||||
Assert.notNull(id, "The given id must not be null!");
|
||||
Assert.notNull(id, "The given id must not be null");
|
||||
|
||||
return operations.findById(id, entityInformation.getJavaType());
|
||||
}
|
||||
@@ -111,7 +111,7 @@ public class SimpleKeyValueRepository<T, ID> implements KeyValueRepository<T, ID
|
||||
@Override
|
||||
public List<T> findAllById(Iterable<ID> ids) {
|
||||
|
||||
Assert.notNull(ids, "The given Iterable of id's must not be null!");
|
||||
Assert.notNull(ids, "The given Iterable of id's must not be null");
|
||||
|
||||
List<T> result = new ArrayList<>();
|
||||
|
||||
@@ -128,7 +128,7 @@ public class SimpleKeyValueRepository<T, ID> implements KeyValueRepository<T, ID
|
||||
@Override
|
||||
public void deleteById(ID id) {
|
||||
|
||||
Assert.notNull(id, "The given id must not be null!");
|
||||
Assert.notNull(id, "The given id must not be null");
|
||||
|
||||
operations.delete(id, entityInformation.getJavaType());
|
||||
}
|
||||
@@ -136,7 +136,7 @@ public class SimpleKeyValueRepository<T, ID> implements KeyValueRepository<T, ID
|
||||
@Override
|
||||
public void delete(T entity) {
|
||||
|
||||
Assert.notNull(entity, "The given entity must not be null!");
|
||||
Assert.notNull(entity, "The given entity must not be null");
|
||||
|
||||
operations.delete(entity);
|
||||
}
|
||||
@@ -144,7 +144,7 @@ public class SimpleKeyValueRepository<T, ID> implements KeyValueRepository<T, ID
|
||||
@Override
|
||||
public void deleteAllById(Iterable<? extends ID> ids) {
|
||||
|
||||
Assert.notNull(ids, "The given Iterable of Ids must not be null!");
|
||||
Assert.notNull(ids, "The given Iterable of Ids must not be null");
|
||||
|
||||
ids.forEach(this::deleteById);
|
||||
}
|
||||
@@ -152,7 +152,7 @@ public class SimpleKeyValueRepository<T, ID> implements KeyValueRepository<T, ID
|
||||
@Override
|
||||
public void deleteAll(Iterable<? extends T> entities) {
|
||||
|
||||
Assert.notNull(entities, "The given Iterable of entities must not be null!");
|
||||
Assert.notNull(entities, "The given Iterable of entities must not be null");
|
||||
|
||||
entities.forEach(this::delete);
|
||||
}
|
||||
@@ -169,7 +169,7 @@ public class SimpleKeyValueRepository<T, ID> implements KeyValueRepository<T, ID
|
||||
@Override
|
||||
public List<T> findAll(Sort sort) {
|
||||
|
||||
Assert.notNull(sort, "Sort must not be null!");
|
||||
Assert.notNull(sort, "Sort must not be null");
|
||||
|
||||
return IterableConverter.toList(operations.findAll(sort, entityInformation.getJavaType()));
|
||||
}
|
||||
@@ -177,7 +177,7 @@ public class SimpleKeyValueRepository<T, ID> implements KeyValueRepository<T, ID
|
||||
@Override
|
||||
public Page<T> findAll(Pageable pageable) {
|
||||
|
||||
Assert.notNull(pageable, "Pageable must not be null!");
|
||||
Assert.notNull(pageable, "Pageable must not be null");
|
||||
|
||||
if (pageable.isUnpaged()) {
|
||||
List<T> result = findAll();
|
||||
|
||||
@@ -116,8 +116,8 @@ public class MapKeyValueAdapter extends AbstractKeyValueAdapter {
|
||||
|
||||
super(engine);
|
||||
|
||||
Assert.notNull(store, "Store must not be null.");
|
||||
Assert.notNull(keySpaceMapType, "Map type to be used for key spaces must not be null!");
|
||||
Assert.notNull(store, "Store must not be null");
|
||||
Assert.notNull(keySpaceMapType, "Map type to be used for key spaces must not be null");
|
||||
|
||||
this.store = store;
|
||||
this.keySpaceMapType = keySpaceMapType;
|
||||
@@ -126,8 +126,8 @@ public class MapKeyValueAdapter extends AbstractKeyValueAdapter {
|
||||
@Override
|
||||
public Object put(Object id, Object item, String keyspace) {
|
||||
|
||||
Assert.notNull(id, "Cannot add item with null id.");
|
||||
Assert.notNull(keyspace, "Cannot add item for null collection.");
|
||||
Assert.notNull(id, "Cannot add item with null id");
|
||||
Assert.notNull(keyspace, "Cannot add item for null collection");
|
||||
|
||||
return getKeySpaceMap(keyspace).put(id, item);
|
||||
}
|
||||
@@ -145,14 +145,14 @@ public class MapKeyValueAdapter extends AbstractKeyValueAdapter {
|
||||
@Override
|
||||
public Object get(Object id, String keyspace) {
|
||||
|
||||
Assert.notNull(id, "Cannot get item with null id.");
|
||||
Assert.notNull(id, "Cannot get item with null id");
|
||||
return getKeySpaceMap(keyspace).get(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object delete(Object id, String keyspace) {
|
||||
|
||||
Assert.notNull(id, "Cannot delete item with null id.");
|
||||
Assert.notNull(id, "Cannot delete item with null id");
|
||||
return getKeySpaceMap(keyspace).remove(id);
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ public class MapKeyValueAdapter extends AbstractKeyValueAdapter {
|
||||
*/
|
||||
protected Map<Object, Object> getKeySpaceMap(String keyspace) {
|
||||
|
||||
Assert.notNull(keyspace, "Collection must not be null for lookup!");
|
||||
Assert.notNull(keyspace, "Collection must not be null for lookup");
|
||||
return store.computeIfAbsent(keyspace, k -> CollectionFactory.createMap(keySpaceMapType, 1000));
|
||||
}
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ class MapRepositoriesConfigurationExtensionIntegrationTests {
|
||||
|
||||
PersonRepository repository = context.getBean(PersonRepository.class);
|
||||
|
||||
assertThatThrownBy(() -> repository.findById("foo")).hasRootCauseInstanceOf(IllegalStateException.class).hasMessageContaining("Mock!");
|
||||
assertThatThrownBy(() -> repository.findById("foo")).hasRootCauseInstanceOf(IllegalStateException.class).hasMessageContaining("Mock");
|
||||
|
||||
context.close();
|
||||
}
|
||||
@@ -128,7 +128,7 @@ class MapRepositoriesConfigurationExtensionIntegrationTests {
|
||||
|
||||
KeyValueAdapter mock = mock(KeyValueAdapter.class);
|
||||
|
||||
when(mock.get(any(), anyString(), any())).thenThrow(new IllegalStateException("Mock!"));
|
||||
when(mock.get(any(), anyString(), any())).thenThrow(new IllegalStateException("Mock"));
|
||||
|
||||
return mock;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user