Package land.oras
Class Index
java.lang.Object
land.oras.Descriptor
land.oras.Index
- All Implemented Interfaces:
Describable
Index from an OCI layout
-
Field Summary
Fields inherited from class land.oras.Descriptor
annotations, artifactType, digest, json, mediaType, registry, size -
Method Summary
Modifier and TypeMethodDescriptionbooleanFilter the manifests by platformfilter(Platform platform, BiPredicate<Platform, Platform> comparator) Filter the manifests by platform with a custom comparator@Nullable ManifestDescriptorfindUnique(Platform platform) Find a unique manifest by platform.static IndexCreate an index from a JSON stringstatic IndexfromManifests(List<ManifestDescriptor> descriptors) Create an index from a list of manifestsstatic IndexCreate an index from a pathGet the annotations@NonNull ArtifactTypeGet the artifact typeGet the artifact type as string for JSON serializationGet the manifest descriptor for this describableGet the list of manifestsintGet the schema versionGet the subjectinthashCode()toString()Get the list of manifests that have unspecified platformwithArtifactType(ArtifactType artifactType) Return a new index with the given artifact typewithDescriptor(ManifestDescriptor descriptor) Return a new index with the given descriptorprotected IndexReturn same instance but with original JSONwithNewManifests(ManifestDescriptor manifest) Return a new index with new manifest added to indexwithSubject(Subject subject) Return a new index with the given subjectMethods inherited from class land.oras.Descriptor
getAnnotationsForJson, getDigest, getJson, getMediaType, getRegistry, getSize, of, of, of, toJson, toSubject, withRegistry
-
Method Details
-
getSchemaVersion
public int getSchemaVersion()Get the schema version- Returns:
- The schema version
-
getManifests
Get the list of manifests- Returns:
- The list of manifests
-
filter
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 platformcomparator- 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
Get the list of manifests that have unspecified platform- Returns:
- The list of manifests that have unspecified platform
-
findUnique
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
Description copied from class:DescriptorGet the artifact type- Overrides:
getArtifactTypein classDescriptor- Returns:
- The artifact type
-
getArtifactTypeAsString
Get the artifact type as string for JSON serialization- Returns:
- The artifact type as string
-
withNewManifests
Return a new index with new manifest added to index- Parameters:
manifest- The manifest- Returns:
- The index
-
getDescriptor
Description copied from interface:DescribableGet the manifest descriptor for this describable- Specified by:
getDescriptorin interfaceDescribable- Returns:
- The manifest descriptor
-
getAnnotations
Get the annotations- Overrides:
getAnnotationsin classDescriptor- Returns:
- The annotations
-
withArtifactType
Return a new index with the given artifact type- Parameters:
artifactType- The artifact type- Returns:
- The index
-
withDescriptor
Return a new index with the given descriptor- Parameters:
descriptor- The descriptor- Returns:
- The manifest
-
withJson
Return same instance but with original JSON- Overrides:
withJsonin classDescriptor- Parameters:
json- The original JSON- Returns:
- The index
-
getSubject
Description copied from interface:DescribableGet the subject- Specified by:
getSubjectin interfaceDescribable- Returns:
- The subject
-
withSubject
Return a new index with the given subject- Parameters:
subject- The subject- Returns:
- The index
-
fromJson
Create an index from a JSON string- Parameters:
json- The JSON string- Returns:
- The index
-
fromPath
Create an index from a path- Parameters:
path- The path- Returns:
- The index
-
fromManifests
Create an index from a list of manifests- Parameters:
descriptors- The list of manifests- Returns:
- The index
-
equals
- Overrides:
equalsin classDescriptor
-
hashCode
public int hashCode()- Overrides:
hashCodein classDescriptor
-
toString
- Overrides:
toStringin classDescriptor
-