Package land.oras
Class Descriptor
java.lang.Object
land.oras.Descriptor
Main class for descriptor
-
Field Summary
FieldsModifier and TypeFieldDescriptionAnnotations for the layerprotected final @Nullable StringThe artifact typeprotected final @Nullable StringThe digest of the layerprotected StringOriginal jsonprotected final StringThe media type of the layerprotected @Nullable StringThe registryprotected final @Nullable LongThe size of the layer -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanGet the annotationsWe never serialize empty annotations@Nullable ArtifactTypeGet the artifact type@Nullable StringGet the digestgetJson()Return the original JSONfinal StringGet the media type@Nullable StringReturn the resolved registry.@Nullable LonggetSize()Get the sizeinthashCode()static DescriptorCreate a new descriptorstatic DescriptorCreate a new descriptorstatic DescriptorCreate a new descriptorfinal StringtoJson()Return the JSON representation of this descriptortoString()Return this manifest descriptor as a subjectprotected DescriptorReturn same instance but with original JSONprotected DescriptorwithRegistry(String registry) Return same instance but with resolved registry
-
Field Details
-
mediaType
The media type of the layer -
annotations
Annotations for the layer -
digest
The digest of the layer -
size
The size of the layer -
artifactType
The artifact type -
json
Original json -
registry
The registry
-
-
Constructor Details
-
Descriptor
protected Descriptor(String digest, Long size, String mediaType, Map<String, String> annotations, String artifactType, String registry, String json) Constructor- Parameters:
digest- The digestsize- The sizemediaType- The media typeannotations- The annotationsartifactType- The artifact typejson- The original JSON
-
-
Method Details
-
getJson
Return the original JSON- Returns:
- The original JSON
-
getRegistry
Return the resolved registry. Useful to avoid querying registry blobs when the registry is already resolved in the descriptor.- Returns:
- The resolved registry or null if not resolved
-
getAnnotations
Get the annotations- Returns:
- The annotations
-
getAnnotationsForJson
We never serialize empty annotations- Returns:
- The annotations or null
-
getMediaType
Get the media type- Returns:
- The media type
-
getDigest
Get the digest- Returns:
- The digest
-
getSize
Get the size- Returns:
- The size
-
getArtifactType
Get the artifact type- Returns:
- The artifact type
-
toJson
Return the JSON representation of this descriptor- Returns:
- The JSON string
-
withJson
Return same instance but with original JSON- Parameters:
json- The original JSON- Returns:
- The index
-
withRegistry
Return same instance but with resolved registry- Parameters:
registry- The resolved registry- Returns:
- The descriptor with resolved registry
-
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 digestsize- The sizemediaType- The media typeannotations- The annotationsartifactType- The artifact type- Returns:
- The descriptor
-
of
Create a new descriptor- Parameters:
digest- The digestsize- The sizemediaType- The media type- Returns:
- The descriptor
-
of
Create a new descriptor- Parameters:
digest- The digestsize- The size- Returns:
- The descriptor
-
equals
-
hashCode
public int hashCode() -
toString
-