code: @SuppressWarnings("unchecked")
      public <U extends BeanPath<? extends T>> U as(Class<U> clazz) {
          try {
              if (!casts.containsKey(clazz)) {
                  PathMetadata metadata;
                  if (pathMixin.getMetadata().getPathType() != PathType.COLLECTION_ANY) {
                      metadata = PathMetadataFactory.forDelegate(pathMixin);
                  } else {
                      metadata = pathMixin.getMetadata();
                  }
                  U rv;
                  // the inits for the subtype will be wider, if it's a variable path
                  if (inits != null && pathMixin.getMetadata().getPathType() != PathType.VARIABLE) {
                      rv = clazz.getConstructor(PathMetadata.class, PathInits.class).newInstance(metadata, inits);
                  } else {
                      rv = clazz.getConstructor(PathMetadata.class).newInstance(metadata);
                  }
                  casts.put(clazz, rv);
                  return rv;
              } else {
                  return (U) casts.get(clazz);
              }
  
          } 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);
          }
      }
docs: Cast the path to a subtype querytype
  
  @param <U>
  @param clazz subtype class
  @return subtype instance with the same identity