public static <U extends BeanPath<? extends T>, T> U treat(BeanPath<? extends T> path, Class<U> subtype)  {
        try {
            Class<? extends T> entitySubType = getConcreteEntitySubType(subtype);
            PathMetadata pathMetadata = new PathMetadata(path, getEntityName(entitySubType), PathType.TREATED_PATH);
            return subtype.getConstructor(PathMetadata.class).newInstance(pathMetadata);
        } catch (InstantiationException e) {
            throw new ExpressionException(e.getMessage(), e);
        } catch (IllegalAccessException e) {
            throw new ExpressionException(e.getMessage(), e);
        } catch (InvocationTargetException e) {
            throw new ExpressionException(e.getMessage(), e);
        } catch (NoSuchMethodException e) {
            throw new ExpressionException(e.getMessage(), e);
        }
    }
Create a JPA 2.1 treated path.

@param path The path to apply the treat operation on
@param subtype subtype class
@param <U> the subtype class
@param <T> the expression type
@return subtype instance with the same identity
querydsl-jpa/src/main/java/com/querydsl/jpa/JPAExpressions.java