use of org.springframework.data.util.CastUtils in project spring-data-commons by spring-projects.
the class QuerydslPredicateArgumentResolverSupport method getPredicate.
Predicate getPredicate(MethodParameter parameter, MultiValueMap<String, String> queryParameters) {
MergedAnnotations annotations = MergedAnnotations.from(parameter.getParameter());
MergedAnnotation<QuerydslPredicate> predicateAnnotation = annotations.get(QuerydslPredicate.class);
TypeInformation<?> domainType = extractTypeInfo(parameter, predicateAnnotation).getRequiredActualType();
Optional<Class<? extends QuerydslBinderCustomizer<?>>> bindingsAnnotation = //
predicateAnnotation.getValue("bindings").map(CastUtils::cast);
QuerydslBindings bindings = //
bindingsAnnotation.map(//
it -> bindingsFactory.createBindingsFor(domainType, it)).orElseGet(() -> bindingsFactory.createBindingsFor(domainType));
return predicateBuilder.getPredicate(domainType, queryParameters, bindings);
}
Aggregations