public static <E> void criteriaToQuery(
            CriteriaParent<E> criteria,
            StringJoiner selectJoiner,
            Elements elements,
            StringJoiner joinJoiner,
            StringJoiner restrictionJoiner,
            StringJoiner qJoiner,
            StringJoiner groupJoiner,
            Map<String, Object> variableMap
    ){
        if(selectJoiner != null) {
            if(criteria.getProjection() != null) {
                String select = HqlUtil.selectForListByProjection(criteria, criteria.getProjection(), null, elements, groupJoiner);
                if(!Validations.isEmptyOrNull(select)) {
                    selectJoiner.add(select);
                }
            }
        }
        if(criteria.getRestrictions() != null && criteria.getRestrictions().size() > 0) {
            HqlUtil.generateRestrictions(
                    criteria,
                    criteria.getRestrictions(),
                    restrictionJoiner,
                    qJoiner,
                    variableMap,
                    new Increment(0)
            );
        }

        if(criteria.getJoins() != null && criteria.getJoins().size() > 0) {
            for(Map.Entry<String, CriteriaJoin<E>> joinEntry: criteria.getJoins().entrySet()) {
                String joinToString = HqlUtil.joinToString(joinEntry.getValue());
                if(!Validations.isEmptyOrNull(joinToString)) {
                    joinJoiner.add(joinToString);
                }
                criteriaToQuery(joinEntry.getValue(), selectJoiner, elements, joinJoiner, restrictionJoiner, qJoiner, groupJoiner, variableMap);
            }
        }
    }
public static < E > void criteriaToQuery ( CriteriaParent < E > criteria , StringJoiner selectJoiner , Elements elements , StringJoiner joinJoiner , StringJoiner restrictionJoiner , StringJoiner qJoiner , StringJoiner groupJoiner , Map < String , Object > variableMap ) { if ( selectJoiner != null ) { if ( criteria . getProjection ( ) != null ) { String select = HqlUtil . selectForListByProjection ( criteria , criteria . getProjection ( ) , null , elements , groupJoiner ) ; if ( ! Validations . isEmptyOrNull ( select ) ) { selectJoiner . add ( select ) ; } } } if ( criteria . getRestrictions ( ) != null && criteria . getRestrictions ( ) . size ( ) > 0 ) { HqlUtil . generateRestrictions ( criteria , criteria . getRestrictions ( ) , restrictionJoiner , qJoiner , variableMap , new Increment ( 0 ) ) ; } if ( criteria . getJoins ( ) != null && criteria . getJoins ( ) . size ( ) > 0 ) { for ( Map . Entry < String , CriteriaJoin < E > > joinEntry : criteria . getJoins ( ) . entrySet ( ) ) { String joinToString = HqlUtil . joinToString ( joinEntry . getValue ( ) ) ; if ( ! Validations . isEmptyOrNull ( joinToString ) ) { joinJoiner . add ( joinToString ) ; } criteriaToQuery ( joinEntry . getValue ( ) , selectJoiner , elements , joinJoiner , restrictionJoiner , qJoiner , groupJoiner , variableMap ) ; } } }
@param criteria
@param selectJoiner
@param elements
@param joinJoiner
@param restrictionJoiner
@param qJoiner
@param groupJoiner
@param variableMap
@param <E>