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 from AbstractMetadata 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.
  • Method Details

    • 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

      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

      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

      Gets the type of the metadata, e.g. "maven-metadata.xml".
      Returns:
      The type of the metadata, never null.
    • getNature

      Gets the nature of this metadata. The nature indicates to what artifact versions the metadata refers.
      Returns:
      The nature, never null.
    • getFile

      Deprecated.
      Use getPath() instead.
      Gets the file of this metadata. Note that only resolved metadata has a file associated with it.
      Returns:
      The file or null if none.
    • getPath

      Gets the file of this metadata. Note that only resolved metadata has a file associated with it.
      Returns:
      The file or null if none.
      Since:
      2.0.0
    • setFile

      Deprecated.
      Use setPath(Path) instead.
      Sets the file of the metadata.
      Parameters:
      file - The file of the metadata, may be null
      Returns:
      The new metadata, never null.
    • setPath

      Sets the file of the metadata.
      Parameters:
      path - The file of the metadata, may be null
      Returns:
      The new metadata, never null.
      Since:
      2.0.0
    • getProperty

      String getProperty(String key, String defaultValue)
      Gets the specified property.
      Parameters:
      key - The name of the property, must not be null.
      defaultValue - The default value to return in case the property is not set, may be null.
      Returns:
      The requested property value or null if the property is not set and no default value was provided.
    • getProperties

      Gets the properties of this metadata.
      Returns:
      The (read-only) properties, never null.
    • setProperties

      Sets the properties for the metadata.
      Parameters:
      properties - The properties for the metadata, may be null.
      Returns:
      The new metadata, never null.