Package land.oras

Class Descriptor

java.lang.Object
land.oras.Descriptor
Direct Known Subclasses:
Config, Index, Layer, Manifest

public sealed class Descriptor extends Object permits Config, Manifest, Layer, Index
Main class for descriptor
  • Field Details

    • mediaType

      protected final String mediaType
      The media type of the layer
    • annotations

      protected final @Nullable Map<String,String> annotations
      Annotations for the layer
    • digest

      protected final @Nullable String digest
    • size

      protected final @Nullable Long size
    • artifactType

      protected final @Nullable String artifactType
    • json

      protected transient String json
      Original json
  • Constructor Details

  • Method Details

    • getJson

      public String getJson()
      Return the original JSON
      Returns:
      The original JSON
    • getAnnotations

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

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

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

      public @Nullable Long getSize()
      Get the size
      Returns:
      The size
    • getArtifactType

      public @Nullable ArtifactType getArtifactType()
      Get the artifact type
      Returns:
      The artifact type
    • toJson

      public final String toJson()
      Return the JSON representation of this descriptor
      Returns:
      The JSON string
    • withJson

      protected Descriptor withJson(String json)
      Return same instance but with original JSON
      Parameters:
      json - The original JSON
      Returns:
      The index
    • toSubject

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

      public static Descriptor of(String digest, Long size, String mediaType, Map<String,String> annotations, String artifactType)
      Create a new descriptor
      Parameters:
      digest - The digest
      size - The size
      mediaType - The media type
      annotations - The annotations
      artifactType - The artifact type
      Returns:
      The descriptor
    • of

      public static Descriptor of(String digest, Long size, String mediaType)
      Create a new descriptor
      Parameters:
      digest - The digest
      size - The size
      mediaType - The media type
      Returns:
      The descriptor
    • of

      public static Descriptor of(String digest, Long size)
      Create a new descriptor
      Parameters:
      digest - The digest
      size - The size
      Returns:
      The descriptor