@Nullable
    private EntityType createEntityType(TypeMirror typeMirror, List<String> key, boolean deep) {
        entityTypeCache.put(key, null);
        Type value = visitor.visit(typeMirror, deep);
        if (value != null) {
            EntityType entityType = null;
            if (value instanceof EntityType) {
                entityType = (EntityType) value;
            } else {
                entityType = new EntityType(value, variableNameFunction);
                typeMappings.register(entityType, queryTypeFactory.create(entityType));
            }
            entityTypeCache.put(key, entityType);

            if (deep) {
                for (Type superType : getSupertypes(typeMirror, deep)) {
                    entityType.addSupertype(new Supertype(superType));
                }
            }

            return entityType;
        } else {
            return null;
        }
    }
{@code ExtendedTypeFactory} is a factory for APT-based inspection {@link Type} creation

@author tiwe
querydsl-apt/src/main/java/com/querydsl/apt/ExtendedTypeFactory.java