public Type get(boolean entity, Class<?> cl, AnnotatedElement annotated, java.lang.reflect.Type genericType) {
        List<Object> key = new ArrayList<>();
        key.add(genericType);
        AnnotationHelper annotationHelper = null;
        Annotation selectedAnnotation = null;
        if (annotated != null) {
            for (Annotation annotation : annotated.getDeclaredAnnotations()) {
                for (AnnotationHelper helper : annotationHelpers) {
                    if (helper.isSupported(annotation.annotationType())) {
                        key.add(annotation.annotationType());
                        selectedAnnotation = annotated.getAnnotation(annotation.annotationType());
                        annotationHelper = helper;
                        key.add(helper.getCustomKey(selectedAnnotation));
                        break;
                    }
                }
            }
        }
        key = Collections.unmodifiableList(key);
        if (cache.containsKey(key)) {
            Type value = cache.get(key);
            if (entity && !(value instanceof EntityType)) {
                value = new EntityType(value, variableNameFunction);
                cache.put(key, value);
            }
            return value;

        } else {
            Type value = create(entity, cl, annotationHelper, selectedAnnotation, genericType, key);
            cache.put(key, value);
            return value;
        }
    }
{@code TypeFactory} is a factory class for {@link Type} instances

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