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.
    • 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
      java.lang.String getArtifactId()
      Gets the artifact identifier of this metadata.
      java.io.File getFile()
      Gets the file of this metadata.
      java.lang.String getGroupId()
      Gets the group identifier of this metadata.
      Metadata.Nature getNature()
      Gets the nature of this metadata.
      java.util.Map<java.lang.String,​java.lang.String> getProperties()
      Gets the properties of this metadata.
      java.lang.String getProperty​(java.lang.String key, java.lang.String defaultValue)
      Gets the specified property.
      java.lang.String getType()
      Gets the type of the metadata, e.g.
      java.lang.String getVersion()
      Gets the version of this metadata.
      Metadata setFile​(java.io.File file)
      Sets the file of the metadata.
      Metadata setProperties​(java.util.Map<java.lang.String,​java.lang.String> properties)
      Sets the properties for the metadata.
    • Method Detail

      • getGroupId

        java.lang.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

        java.lang.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

        java.lang.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

        java.lang.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

        java.io.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​(java.io.File file)
        Sets the file of the metadata.
        Parameters:
        file - The file of the metadata, may be null
        Returns:
        The new metadata, never null.
      • getProperty

        java.lang.String getProperty​(java.lang.String key,
                                     java.lang.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

        java.util.Map<java.lang.String,​java.lang.String> getProperties()
        Gets the properties of this metadata.
        Returns:
        The (read-only) properties, never null.
      • setProperties

        Metadata setProperties​(java.util.Map<java.lang.String,​java.lang.String> properties)
        Sets the properties for the metadata.
        Parameters:
        properties - The properties for the metadata, may be null.
        Returns:
        The new metadata, never null.