public Type getQueryType(Type type, EntityType model, Type exprType, boolean raw,
            boolean rawParameters, boolean extend) {
        TypeCategory category = type.getCategory();
        if (raw && category != TypeCategory.ENTITY && category != TypeCategory.CUSTOM) {
            return exprType;

        } else if (category == TypeCategory.STRING || category == TypeCategory.BOOLEAN) {
            return exprType;

        } else {
            if (rawParameters) {
                type = new SimpleType(type);
            }
            if (!type.isFinal() && extend) {
                type = new TypeExtends(type);
            }
            return new SimpleType(exprType, type);

        }
    }
{@code TypeMappings} defines mappings from Java types to {@link Expression}, {@link Path} and
{@link TemplateExpression} types

@author tiwe
querydsl-codegen/src/main/java/com/querydsl/codegen/TypeMappings.java