@Override
                public Object apply(Object arg) {
                    if (arg instanceof Constant<?>) {
                        return ConstantImpl.create(apply(arg.toString()).toString());
                    } else if (arg instanceof Expression) {
                        Expression<String> concatenated = ExpressionUtils.operation(String.class, Ops.CONCAT, (Expression) arg, PERCENT);
                        return ExpressionUtils.operation(String.class, Ops.LOWER, concatenated);
                    } else {
                        return escapeForLike(String.valueOf(arg).toLowerCase()) + "%";
                    }
                }
{@code TemplateFactory} is a factory for {@link Template} instances

@author tiwe
querydsl-core/src/main/java/com/querydsl/core/types/TemplateFactory.java