@SuppressWarnings("unchecked")
    public static <T> TemplateExpression<T> template(Class<? extends T> cl, Template template, List<?> args) {
        if (cl.equals(Boolean.class)) {
            return (TemplateExpression<T>) new PredicateTemplate(template, args);
        } else {
            return new TemplateExpressionImpl<T>(cl, template, args);
        }
    }
Create a new Template expression

@param cl type of expression
@param template template
@param args template parameters
@return template expression
querydsl-core/src/main/java/com/querydsl/core/types/ExpressionUtils.java