private static void verifyImageMetadata(ImageMetadataTemplate metadata) {
    Predicate<ManifestAndConfigTemplate> isManifestNull = pair -> pair.getManifest() == null;
    Predicate<ManifestAndConfigTemplate> isConfigNull = pair -> pair.getConfig() == null;
    Predicate<ManifestAndConfigTemplate> isDigestNull = pair -> pair.getManifestDigest() == null;

    List<ManifestAndConfigTemplate> manifestsAndConfigs = metadata.getManifestsAndConfigs();
    Preconditions.checkArgument(!manifestsAndConfigs.isEmpty(), "no manifests given");
    Preconditions.checkArgument(
        manifestsAndConfigs.stream().noneMatch(isManifestNull), "null manifest(s)");
    Preconditions.checkArgument(
        metadata.getManifestList() != null || manifestsAndConfigs.size() == 1,
        "manifest list missing while multiple manifests given");

    ManifestTemplate firstManifest = manifestsAndConfigs.get(0).getManifest();
    if (firstManifest instanceof V21ManifestTemplate) {
      Preconditions.checkArgument(
          metadata.getManifestList() == null, "manifest list given for schema 1");
      Preconditions.checkArgument(
          isConfigNull.test(manifestsAndConfigs.get(0)), "container config given for schema 1");
    } else if (firstManifest instanceof BuildableManifestTemplate) {
      Preconditions.checkArgument(
          manifestsAndConfigs.stream().noneMatch(isConfigNull), "null container config(s)");
      if (metadata.getManifestList() != null) {
        Preconditions.checkArgument(
            manifestsAndConfigs.stream().noneMatch(isDigestNull), "null manifest digest(s)");
      }
    } else {
      throw new IllegalArgumentException("Unknown manifest type: " + firstManifest);
    }
  }
Holds information about a layer that was written.
jib-core/src/main/java/com/google/cloud/tools/jib/cache/CacheStorageWriter.java