DATACMNS-867 - Cleanups in Querydsl support.
This commit is contained in:
@@ -55,7 +55,6 @@ public class QSort extends Sort implements Serializable {
|
||||
*
|
||||
* @param orderSpecifiers must not be {@literal null}.
|
||||
*/
|
||||
|
||||
public QSort(List<OrderSpecifier<?>> orderSpecifiers) {
|
||||
|
||||
super(toOrders(orderSpecifiers));
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
package org.springframework.data.querydsl.binding;
|
||||
|
||||
import java.beans.PropertyDescriptor;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@@ -41,7 +40,6 @@ import org.springframework.util.StringUtils;
|
||||
import com.querydsl.core.BooleanBuilder;
|
||||
import com.querydsl.core.types.Path;
|
||||
import com.querydsl.core.types.Predicate;
|
||||
import com.querydsl.core.types.dsl.CollectionPathBase;
|
||||
|
||||
/**
|
||||
* Builder assembling {@link Predicate} out of {@link PropertyValues}.
|
||||
@@ -153,36 +151,6 @@ public class QuerydslPredicateBuilder {
|
||||
return resolvedPath.orElseGet(() -> paths.computeIfAbsent(path, it -> it.reifyPath(resolver)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tries to reify a Querydsl {@link Path} from the given {@link PropertyPath} and base.
|
||||
*
|
||||
* @param path must not be {@literal null}.
|
||||
* @param base can be empty.
|
||||
* @return
|
||||
*/
|
||||
private Path<?> reifyPath(PropertyPath path, Optional<Path<?>> base) {
|
||||
|
||||
Optional<Path<?>> map = base.filter(it -> it instanceof CollectionPathBase)
|
||||
.map(it -> CollectionPathBase.class.cast(it))//
|
||||
.map(CollectionPathBase::any)//
|
||||
.map(it -> Path.class.cast(it))//
|
||||
.map(it -> reifyPath(path, Optional.of(it)));
|
||||
|
||||
return map.orElseGet(() -> {
|
||||
|
||||
Path<?> entityPath = base.orElseGet(() -> resolver.createPath(path.getOwningType().getType()));
|
||||
|
||||
Field field = ReflectionUtils.findField(entityPath.getClass(), path.getSegment());
|
||||
Object value = ReflectionUtils.getField(field, entityPath);
|
||||
|
||||
if (path.hasNext()) {
|
||||
return reifyPath(path.next(), Optional.of((Path<?>) value));
|
||||
}
|
||||
|
||||
return (Path<?>) value;
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the given source values into a collection of elements that are of the given {@link PropertyPath}'s type.
|
||||
* Considers a single element list with an empty {@link String} an empty collection because this basically indicates
|
||||
|
||||
Reference in New Issue
Block a user