class RenderResultImpl implements RenderResult {

        private final String sql;
        private final List<Object> values;

        RenderResultImpl(String sql, List<Object> values /*, Pipeline pipeline*/) {
            this.sql = sql;
            this.values = values;
        }

        @Override
        public String getSql() {
            return sql;
        }

        @Override
        public List<Object> getValues() {
            return values;
        }

        @Override
        public String toString() {
            return String.format("RenderResultImpl {sql=%s, values=%s}", sql, values);
        }
    }

    public static <ENTITY> RenderResult renderSqlWhere(
        final DbmsType dbmsType,
        final Function<Field<ENTITY>, String> columnNamer,
        final Function<Field<ENTITY>, Class<?>> columnDbTypeFunction,
        final List<Predicate<ENTITY>> predicates
    ) {
        final FieldPredicateView predicateView = dbmsType.getFieldPredicateView();
        final StringBuilder sql = new StringBuilder();
        final List<Object> values = new ArrayList<>();
        final AtomicInteger cnt = new AtomicInteger();
        predicates
            .stream()
            // Optimize away ALWAYS_TRUE. Fix #495
            .filter(p -> {
                if (p instanceof FieldPredicate) {
                    return ((FieldPredicate)p).getPredicateType() != PredicateType.ALWAYS_TRUE;
                } else {
                    return true;
                }
            })
            .forEach(predicate -> {
            if (cnt.getAndIncrement() != 0) {
                sql.append(" AND ");
            }
            renderSqlWhereHelper(predicateView, columnNamer, columnDbTypeFunction, sql, values, predicate);
        });
        return new RenderResultImpl(sql.toString(), values);
    }

    // See JoinSqlUtil::renderPredicateHelper for JOIN streams

    private static <ENTITY> void renderSqlWhereHelper(
        final FieldPredicateView spv,
        final Function<Field<ENTITY>, String> columnNamer,
        final Function<Field<ENTITY>, Class<?>> columnDbTypeFunction,
        final StringBuilder sql,
        final List<Object> values,
        final Predicate<ENTITY> predicate
    ) {<FILL_FUNCTION_BODY>

        if (predicate instanceof FieldPredicate) {
            final FieldPredicate<ENTITY> fieldPredicate = (FieldPredicate<ENTITY>) predicate;
            final SqlPredicateFragment fragment = spv.transform(columnNamer, columnDbTypeFunction, fieldPredicate);
            final Field<ENTITY> referenceFieldTrait = fieldPredicate.getField();
            @SuppressWarnings("unchecked")
            final TypeMapper<Object, Object> tm = (TypeMapper<Object, Object>) referenceFieldTrait.typeMapper();

            sql.append(fragment.getSql());
            fragment.objects().map(tm::toDatabaseType).forEachOrdered(values::add);
        } else if (predicate instanceof CombinedPredicate) {
            final CombinedPredicate<ENTITY> combinedPredicate = (CombinedPredicate<ENTITY>) predicate;
            final StringBuilder internalSql = new StringBuilder();
            final List<Object> internalValues = new ArrayList<>();
            final AtomicInteger cnt = new AtomicInteger();
            combinedPredicate.stream().forEachOrdered(internalPredicate -> {
                if (cnt.getAndIncrement() != 0) {
                    internalSql.append(" ").append(combinedPredicate.getType().toString()).append(" ");
                }
                @SuppressWarnings("unchecked")
                final Predicate<ENTITY> castedInternalPredicate = (Predicate<ENTITY>) internalPredicate;
                renderSqlWhereHelper(
                    spv,
                    columnNamer,
                    columnDbTypeFunction,
                    internalSql,
                    internalValues,
                    castedInternalPredicate
                );
            });
            sql.append("(").append(internalSql).append(")");
            values.addAll(internalValues);
        } else {
            throw new IllegalArgumentException("A predicate that is nether an instanceof FieldPredicate nor CombinedPredicate was given:" + predicate.toString());
        }
    
<no_super_class>