cz.encircled.joiner.core.PredicateAliasResolver Maven / Gradle / Ivy
package cz.encircled.joiner.core;
import com.querydsl.core.types.Operation;
import com.querydsl.core.types.Path;
import com.querydsl.core.types.Predicate;
import cz.encircled.joiner.query.join.JoinDescription;
import java.lang.reflect.AnnotatedElement;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* Implementation is responsible for predicate aliases lookup in a query
*
* @author Vlad on 10-Feb-17.
*/
public interface PredicateAliasResolver {
/**
* Resolves all correct paths used in specified predicate
*
* @param predicate original predicate
* @param joins all query joins
* @param usedAliases paths that are present in joins
* @return rebuilt predicate
* @see PredicateAliasResolver#resolvePath(Path, Map, Set)
*/
Predicate resolvePredicate(Predicate predicate, List joins, Set> usedAliases);
/**
* Resolves all correct paths used in specified operation
*
* @param operation original operation
* @param joins all query joins
* @param usedAliases paths that are present in joins
* @return rebuilt predicate
* @see PredicateAliasResolver#resolvePath(Path, Map, Set)
*/
Predicate resolveOperation(Operation> operation, List joins, Set> usedAliases);
/**
* If alias from path
is not present in usedAliases
, try to find it in joins.
* If unambiguous alias is found, return rebuilt Path with corresponding alias.
*
* It other words, it allows to use QStatus.status.some...
instead of J#path(QStatusParent.parent, QStatus.status
* (when target path is unambiguous, i.e. exactly one join with java type Status is present)
*
*
* @param path original path
* @param classToJoin java type to present joins
* @param usedAliases paths that are present in joins
* @param any
* @return rebuilt or original path
*/
Path resolvePath(Path path, Map> classToJoin, Set> usedAliases);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy