Package land.oras

Class ManifestDescriptor

java.lang.Object
land.oras.ManifestDescriptor

@NullMarked public final class ManifestDescriptor extends Object
Manifest descriptor
  • Method Details

    • getArtifactType

      public @Nullable String getArtifactType()
      Get the artifact type
      Returns:
      The artifact type
    • getMediaType

      public String getMediaType()
      Get the media type
      Returns:
      The media type
    • getDigest

      public String getDigest()
      Get the digest
      Returns:
      The digest
    • getSize

      public long getSize()
      Get the size
      Returns:
      The size
    • getPlatform

      public Platform getPlatform()
      Return the platform as a Platform object
      Returns:
      The platform
    • getPlatformOrNull

      public @Nullable Platform getPlatformOrNull()
      Return the platform or null if the platform is not set Only use for serialization purposes, as the platform field is nullable in the JSON representation of the manifest descriptor
      Returns:
      The platform or null
    • getAnnotations

      public @Nullable Map<String,String> getAnnotations()
      Get the annotations
      Returns:
      The annotations
    • toJson

      public String toJson()
      Return the JSON representation of the manifest
      Returns:
      The JSON string
    • fromJson

      public static ManifestDescriptor fromJson(String json)
      Create a manifest descriptor from a JSON string
      Parameters:
      json - The JSON string
      Returns:
      The manifest
    • toDescriptor

      public Descriptor toDescriptor()
      Return this manifest descriptor as a descriptor
      Returns:
      The descriptor
    • toSubject

      public Subject toSubject()
      Return this manifest descriptor as a subject
      Returns:
      The subject
    • withAnnotations

      public ManifestDescriptor withAnnotations(@Nullable Map<String,String> annotations)
      Create a manifest descriptor with the given annotations
      Parameters:
      annotations - The annotations
      Returns:
      The subject
    • withArtifactType

      public ManifestDescriptor withArtifactType(@Nullable String artifactType)
      Create a manifest descriptor with the given artifact type
      Parameters:
      artifactType - The artifact type
      Returns:
      The subject
    • withPlatform

      public ManifestDescriptor withPlatform(Platform platform)
      Create a manifest descriptor with the given platform
      Parameters:
      platform - The platform
      Returns:
      The subject
    • of

      public static ManifestDescriptor of(String mediaType, String digest, long size)
      Create a manifest descriptor
      Parameters:
      mediaType - The media type
      digest - The digest
      size - The size
      Returns:
      The subject
    • of

      public static ManifestDescriptor of(Descriptor descriptor)
      Create a manifest descriptor
      Parameters:
      descriptor - The descriptor
      Returns:
      The subject
    • of

      public static ManifestDescriptor of(Manifest manifest)
      Utility method. Useful when assembly manifest to be added to an Index using no platform, empty annotations and default supported algorithm
      Parameters:
      manifest - The manifest
      Returns:
      The manifest descriptor
    • of

      public static ManifestDescriptor of(Manifest manifest, Platform platform, Annotations annotations, SupportedAlgorithm supportedAlgorithm)
      Utility method. Useful when assembly manifest to be added to an Index
      Parameters:
      manifest - The manifest
      platform - The platform
      annotations - The annotations
      supportedAlgorithm - The supported algorithm to calculate the digest of the manifest
      Returns:
      The manifest descriptor
    • of

      public static ManifestDescriptor of(Descriptor descriptor, @Nullable String digest)
      Create a manifest descriptor with the given digest
      Parameters:
      descriptor - The descriptor
      digest - The digest
      Returns:
      The subject
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object