Package org.eclipse.aether.metadata
Interface Metadata
-
- All Known Subinterfaces:
MergeableMetadata
- All Known Implementing Classes:
AbstractMetadata
,DefaultMetadata
public interface Metadata
A piece of repository metadata, e.g. an index of available versions. In contrast to an artifact, which usually exists in only one repository, metadata usually exists in multiple repositories and each repository contains a different copy of the metadata. Note: Metadata instances are supposed to be immutable, e.g. any exposed mutator method returns a new metadata instance and leaves the original instance unchanged. Implementors are strongly advised to obey this contract. Note: Implementors are strongly advised to inherit fromAbstractMetadata
instead of directly implementing this interface.- Restriction:
- This interface is not intended to be extended by clients.
- Restriction:
- This interface is not intended to be implemented by clients.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
Metadata.Nature
The nature of the metadata.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description String
getArtifactId()
Gets the artifact identifier of this metadata.File
getFile()
Gets the file of this metadata.String
getGroupId()
Gets the group identifier of this metadata.Metadata.Nature
getNature()
Gets the nature of this metadata.Map<String,String>
getProperties()
Gets the properties of this metadata.String
getProperty(String key, String defaultValue)
Gets the specified property.String
getType()
Gets the type of the metadata, e.g.String
getVersion()
Gets the version of this metadata.Metadata
setFile(File file)
Sets the file of the metadata.Metadata
setProperties(Map<String,String> properties)
Sets the properties for the metadata.
-
-
-
Method Detail
-
getGroupId
String getGroupId()
Gets the group identifier of this metadata.- Returns:
- The group identifier or an empty string if the metadata applies to the entire repository, never
null
.
-
getArtifactId
String getArtifactId()
Gets the artifact identifier of this metadata.- Returns:
- The artifact identifier or an empty string if the metadata applies to the groupId level only, never
null
.
-
getVersion
String getVersion()
Gets the version of this metadata.- Returns:
- The version or an empty string if the metadata applies to the groupId:artifactId level only, never
null
.
-
getType
String getType()
Gets the type of the metadata, e.g. "maven-metadata.xml".- Returns:
- The type of the metadata, never
null
.
-
getNature
Metadata.Nature getNature()
Gets the nature of this metadata. The nature indicates to what artifact versions the metadata refers.- Returns:
- The nature, never
null
.
-
getFile
File getFile()
Gets the file of this metadata. Note that only resolved metadata has a file associated with it.- Returns:
- The file or
null
if none.
-
setFile
Metadata setFile(File file)
Sets the file of the metadata.- Parameters:
file
- The file of the metadata, may benull
- Returns:
- The new metadata, never
null
.
-
getProperty
String getProperty(String key, String defaultValue)
Gets the specified property.- Parameters:
key
- The name of the property, must not benull
.defaultValue
- The default value to return in case the property is not set, may benull
.- Returns:
- The requested property value or
null
if the property is not set and no default value was provided.
-
getProperties
Map<String,String> getProperties()
Gets the properties of this metadata.- Returns:
- The (read-only) properties, never
null
.
-
setProperties
Metadata setProperties(Map<String,String> properties)
Sets the properties for the metadata.- Parameters:
properties
- The properties for the metadata, may benull
.- Returns:
- The new metadata, never
null
.
-
-