/**
   * returns the {@link Class} object corresponding to the given java type name and registered type,
   * using the cache on the type in the first instance, falling back to the loader defined the type
   * and context.
   */
  @Beta
  // TODO should this be on the AbstractTypePlanTransformer ?
  public static Class<?> loadActualJavaType(
      String javaTypeName,
      ManagementContext mgmt,
      RegisteredType type,
      RegisteredTypeLoadingContext context) {
    Class<?> result = peekActualJavaType(type);
    if (result != null) return result;

    result =
        CatalogUtils.newClassLoadingContext(
                mgmt, type, context == null ? null : context.getLoader())
            .loadClass(javaTypeName);

    cacheActualJavaType(type, result);
    return result;
  }