public <T extends BuildableManifestTemplate> ManifestTemplate getManifestListTemplate(
      Class<T> manifestTemplateClass) throws IOException {
    Preconditions.checkArgument(
        manifestTemplateClass == V22ManifestTemplate.class,
        "Build an OCI image index is not yet supported");
    Preconditions.checkState(!images.isEmpty(), "no images given");

    V22ManifestListTemplate manifestList = new V22ManifestListTemplate();
    for (Image image : images) {
      ImageToJsonTranslator imageTranslator = new ImageToJsonTranslator(image);

      BlobDescriptor configDescriptor =
          Digests.computeDigest(imageTranslator.getContainerConfiguration());

      BuildableManifestTemplate manifestTemplate =
          imageTranslator.getManifestTemplate(manifestTemplateClass, configDescriptor);
      BlobDescriptor manifestDescriptor = Digests.computeDigest(manifestTemplate);

      ManifestDescriptorTemplate manifest = new ManifestDescriptorTemplate();
      manifest.setMediaType(manifestTemplate.getManifestMediaType());
      manifest.setSize(manifestDescriptor.getSize());
      manifest.setDigest(manifestDescriptor.getDigest().toString());
      manifest.setPlatform(image.getArchitecture(), image.getOs());
      manifestList.addManifest(manifest);
    }
    return manifestList;
  }
Generates a manifest list JSON for the given {@link Image}s.

@param <T> child type of {@link BuildableManifestTemplate}
@param manifestTemplateClass the JSON template to translate the image to
@return a manifest list JSON
@throws IOException if generating a manifest list fails due to an I/O error when computing
    digests
jib-core/src/main/java/com/google/cloud/tools/jib/image/json/ManifestListGenerator.java