private static int countArguments(FactoryExpression<?> expr) {
        int counter = 0;
        for (Expression<?> arg : expr.getArgs()) {
            if (arg instanceof ProjectionRole) {
                arg = ((ProjectionRole) arg).getProjection();
            }
            if (arg instanceof FactoryExpression<?>) {
                counter += countArguments((FactoryExpression<?>) arg);
            } else {
                counter++;
            }
        }
        return counter;
    }
{@code FactoryExpressionAdapter} provides an adapter implementation of the {@link FactoryExpression} interface

@param <T>
querydsl-core/src/main/java/com/querydsl/core/types/FactoryExpressionUtils.java