Package land.oras

Class Index

All Implemented Interfaces:
Describable

public final class Index extends Descriptor implements Describable
Index from an OCI layout
  • Method Details

    • getSchemaVersion

      public int getSchemaVersion()
      Get the schema version
      Returns:
      The schema version
    • getManifests

      public List<ManifestDescriptor> getManifests()
      Get the list of manifests
      Returns:
      The list of manifests
    • filter

      public List<ManifestDescriptor> filter(Platform platform)
      Filter the manifests by platform
      Parameters:
      platform - The platform
      Returns:
      The list of manifests that match the platform
    • filter

      public List<ManifestDescriptor> filter(Platform platform, BiPredicate<Platform,Platform> comparator)
      Filter the manifests by platform with a custom comparator
      Parameters:
      platform - The platform
      comparator - The comparator to compare the platform of the manifest descriptor and the given platform. The first parameter is the platform of the manifest descriptor, and the second parameter is the given platform. The comparator should return true if the manifest descriptor matches the given platform, and false otherwise.
      Returns:
      The list of manifests that match the platform
    • unspecifiedPlatforms

      public List<ManifestDescriptor> unspecifiedPlatforms()
      Get the list of manifests that have unspecified platform
      Returns:
      The list of manifests that have unspecified platform
    • findUnique

      public @Nullable ManifestDescriptor findUnique(Platform platform)
      Find a unique manifest by platform. If there are multiple manifests that match the platform, return null
      Parameters:
      platform - The platform
      Returns:
      The manifest that matches the platform, or null if there are multiple matches or no matches
    • getArtifactType

      public @NonNull ArtifactType getArtifactType()
      Description copied from class: Descriptor
      Get the artifact type
      Overrides:
      getArtifactType in class Descriptor
      Returns:
      The artifact type
    • getArtifactTypeAsString

      public String getArtifactTypeAsString()
      Get the artifact type as string for JSON serialization
      Returns:
      The artifact type as string
    • withNewManifests

      public Index withNewManifests(ManifestDescriptor manifest)
      Return a new index with new manifest added to index
      Parameters:
      manifest - The manifest
      Returns:
      The index
    • getDescriptor

      public ManifestDescriptor getDescriptor()
      Description copied from interface: Describable
      Get the manifest descriptor for this describable
      Specified by:
      getDescriptor in interface Describable
      Returns:
      The manifest descriptor
    • getAnnotations

      public @Nullable Map<String,String> getAnnotations()
      Get the annotations
      Overrides:
      getAnnotations in class Descriptor
      Returns:
      The annotations
    • withArtifactType

      public Index withArtifactType(ArtifactType artifactType)
      Return a new index with the given artifact type
      Parameters:
      artifactType - The artifact type
      Returns:
      The index
    • withDescriptor

      public Index withDescriptor(ManifestDescriptor descriptor)
      Return a new index with the given descriptor
      Parameters:
      descriptor - The descriptor
      Returns:
      The manifest
    • withJson

      protected Index withJson(String json)
      Return same instance but with original JSON
      Overrides:
      withJson in class Descriptor
      Parameters:
      json - The original JSON
      Returns:
      The index
    • getSubject

      public Subject getSubject()
      Description copied from interface: Describable
      Get the subject
      Specified by:
      getSubject in interface Describable
      Returns:
      The subject
    • withSubject

      public Index withSubject(Subject subject)
      Return a new index with the given subject
      Parameters:
      subject - The subject
      Returns:
      The index
    • fromJson

      public static Index fromJson(String json)
      Create an index from a JSON string
      Parameters:
      json - The JSON string
      Returns:
      The index
    • fromPath

      public static Index fromPath(Path path)
      Create an index from a path
      Parameters:
      path - The path
      Returns:
      The index
    • fromManifests

      public static Index fromManifests(List<ManifestDescriptor> descriptors)
      Create an index from a list of manifests
      Parameters:
      descriptors - The list of manifests
      Returns:
      The index
    • equals

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

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

      public String toString()
      Overrides:
      toString in class Descriptor