@SuppressWarnings("rawtypes")
    private Type getGenericParameter(Class<?> cl, java.lang.reflect.Type genericType, int i) {
        java.lang.reflect.Type parameter = ReflectionUtils.getTypeParameter(genericType, i);
        if (parameter instanceof TypeVariable) {
            TypeVariable variable = (TypeVariable) parameter;
            Type rv = get(ReflectionUtils.getTypeParameterAsClass(genericType, i), null, parameter);
            return new TypeExtends(variable.getName(), rv);
        } else if (parameter instanceof WildcardType
                && ((WildcardType) parameter).getUpperBounds()[0].equals(Object.class)
                && ((WildcardType) parameter).getLowerBounds().length == 0) {
            return ANY;
        } else {
            Type rv = get(ReflectionUtils.getTypeParameterAsClass(genericType, i), null, parameter);
            if (parameter instanceof WildcardType) {
                rv = new TypeExtends(rv);
            }
            return rv;
        }
    }
{@code TypeFactory} is a factory class for {@link Type} instances

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