All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cz.encircled.joiner.util.JoinerUtils Maven / Gradle / Ivy

package cz.encircled.joiner.util;

import com.querydsl.core.types.Expression;
import com.querydsl.core.types.Operation;
import com.querydsl.core.types.Path;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Vlad on 29-Dec-16.
 */
public final class JoinerUtils {

    private JoinerUtils() {

    }

    public static List> collectPredicatePaths(Expression expression) {
        List> result = new ArrayList<>();
        collectPredicatePathsInternal(expression, result);
        return result;
    }

    private static void collectPredicatePathsInternal(Expression expression, List> paths) {
        if (expression instanceof Path) {
            paths.add((Path) expression);
        } else if (expression instanceof Operation) {
            for (Expression exp : ((Operation) expression).getArgs()) {
                collectPredicatePathsInternal(exp, paths);
            }
        }
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy