protected String createSource(String source, ClassType projectionType, String[] names,
            Type[] types, String id, Map<String, Object> constants) throws IOException {
        // create source
        StringWriter writer = new StringWriter();
        JavaWriter javaw = new JavaWriter(writer);
        SimpleType idType = new SimpleType(id, "", id);
        javaw.beginClass(idType, null);
        Parameter[] params = new Parameter[names.length + constants.size()];
        for (int i = 0; i < names.length; i++) {
            params[i] = new Parameter(names[i], types[i]);
        }
        int i = names.length;
        for (Map.Entry<String, Object> entry : constants.entrySet()) {
            Type type = new ClassType(TypeCategory.SIMPLE, ClassUtils.normalize(entry.getValue().getClass()));
            params[i++] = new Parameter(entry.getKey(), type);
        }

        javaw.beginStaticMethod(projectionType, "eval", params);
        javaw.append(source);
        javaw.end();
        javaw.end();
        return writer.toString();
    }
@param source
@param projectionType
@param names
@param types
@param id
@param constants
@return
@throws IOException
querydsl-codegen-utils/src/main/java/com/querydsl/codegen/utils/AbstractEvaluatorFactory.java