DATACMNS-867 - Consistent non-capitalization of Querydsl.
This commit is contained in:
@@ -28,7 +28,7 @@ import com.querydsl.core.types.Predicate;
|
||||
* @author Oliver Gierke
|
||||
* @author Thomas Darimont
|
||||
*/
|
||||
public interface QueryDslPredicateExecutor<T> {
|
||||
public interface QuerydslPredicateExecutor<T> {
|
||||
|
||||
/**
|
||||
* Returns a single entity matching the given {@link Predicate} or {@literal null} if none was found.
|
||||
@@ -27,7 +27,7 @@ import org.springframework.util.MultiValueMap;
|
||||
import com.querydsl.core.types.Predicate;
|
||||
|
||||
/**
|
||||
* {@link RepositoryInvoker} that is aware of a {@link QueryDslPredicateExecutor} and {@link Predicate} to be executed
|
||||
* {@link RepositoryInvoker} that is aware of a {@link QuerydslPredicateExecutor} and {@link Predicate} to be executed
|
||||
* for all flavors of {@code findAll(…)}. All other calls are forwarded to the configured delegate.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
@@ -35,18 +35,18 @@ import com.querydsl.core.types.Predicate;
|
||||
public class QuerydslRepositoryInvokerAdapter implements RepositoryInvoker {
|
||||
|
||||
private final RepositoryInvoker delegate;
|
||||
private final QueryDslPredicateExecutor<Object> executor;
|
||||
private final QuerydslPredicateExecutor<Object> executor;
|
||||
private final Predicate predicate;
|
||||
|
||||
/**
|
||||
* Creates a new {@link QuerydslRepositoryInvokerAdapter} for the given delegate {@link RepositoryInvoker},
|
||||
* {@link QueryDslPredicateExecutor} and Querydsl {@link Predicate}.
|
||||
* {@link QuerydslPredicateExecutor} and Querydsl {@link Predicate}.
|
||||
*
|
||||
* @param delegate must not be {@literal null}.
|
||||
* @param executor must not be {@literal null}.
|
||||
* @param predicate can be {@literal null}.
|
||||
*/
|
||||
public QuerydslRepositoryInvokerAdapter(RepositoryInvoker delegate, QueryDslPredicateExecutor<Object> executor,
|
||||
public QuerydslRepositoryInvokerAdapter(RepositoryInvoker delegate, QuerydslPredicateExecutor<Object> executor,
|
||||
Predicate predicate) {
|
||||
|
||||
Assert.notNull(delegate, "Delegate RepositoryInvoker must not be null!");
|
||||
|
||||
@@ -29,10 +29,10 @@ import com.querydsl.core.types.PathType;
|
||||
* @author Oliver Gierke
|
||||
*/
|
||||
@UtilityClass
|
||||
public class QueryDslUtils {
|
||||
public class QuerydslUtils {
|
||||
|
||||
public static final boolean QUERY_DSL_PRESENT = org.springframework.util.ClassUtils
|
||||
.isPresent("com.querydsl.core.types.Predicate", QueryDslUtils.class.getClassLoader());
|
||||
.isPresent("com.querydsl.core.types.Predicate", QuerydslUtils.class.getClassLoader());
|
||||
|
||||
/**
|
||||
* Returns the property path for the given {@link Path}.
|
||||
@@ -17,6 +17,7 @@ package org.springframework.data.querydsl;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
@@ -50,14 +51,12 @@ public enum SimpleEntityPathResolver implements EntityPathResolver {
|
||||
String pathClassName = getQueryClassName(domainClass);
|
||||
|
||||
try {
|
||||
Class<?> pathClass = ClassUtils.forName(pathClassName, domainClass.getClassLoader());
|
||||
Field field = getStaticFieldOfType(pathClass);
|
||||
|
||||
if (field == null) {
|
||||
throw new IllegalStateException(String.format(NO_FIELD_FOUND_TEMPLATE, pathClass));
|
||||
} else {
|
||||
return (EntityPath<T>) ReflectionUtils.getField(field, null);
|
||||
}
|
||||
Class<?> pathClass = ClassUtils.forName(pathClassName, domainClass.getClassLoader());
|
||||
|
||||
return getStaticFieldOfType(pathClass)//
|
||||
.map(it -> (EntityPath<T>) ReflectionUtils.getField(it, null))//
|
||||
.orElseThrow(() -> new IllegalStateException(String.format(NO_FIELD_FOUND_TEMPLATE, pathClass)));
|
||||
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new IllegalArgumentException(String.format(NO_CLASS_FOUND_TEMPLATE, pathClassName, domainClass.getName()),
|
||||
@@ -71,7 +70,7 @@ public enum SimpleEntityPathResolver implements EntityPathResolver {
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
private Field getStaticFieldOfType(Class<?> type) {
|
||||
private Optional<Field> getStaticFieldOfType(Class<?> type) {
|
||||
|
||||
for (Field field : type.getDeclaredFields()) {
|
||||
|
||||
@@ -79,12 +78,12 @@ public enum SimpleEntityPathResolver implements EntityPathResolver {
|
||||
boolean hasSameType = type.equals(field.getType());
|
||||
|
||||
if (isStatic && hasSameType) {
|
||||
return field;
|
||||
return Optional.of(field);
|
||||
}
|
||||
}
|
||||
|
||||
Class<?> superclass = type.getSuperclass();
|
||||
return Object.class.equals(superclass) ? null : getStaticFieldOfType(superclass);
|
||||
return Object.class.equals(superclass) ? Optional.empty() : getStaticFieldOfType(superclass);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.beans.PropertyDescriptor;
|
||||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.data.querydsl.EntityPathResolver;
|
||||
import org.springframework.data.querydsl.QueryDslUtils;
|
||||
import org.springframework.data.querydsl.QuerydslUtils;
|
||||
|
||||
import com.querydsl.core.types.Path;
|
||||
|
||||
@@ -82,7 +82,7 @@ class QuerydslPathInformation implements PathInformation {
|
||||
*/
|
||||
@Override
|
||||
public String toDotPath() {
|
||||
return QueryDslUtils.toDotPath(path);
|
||||
return QuerydslUtils.toDotPath(path);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user