Class DelegatingArtifact

  • All Implemented Interfaces:
    Artifact

    public abstract class DelegatingArtifact
    extends AbstractArtifact
    An artifact that delegates to another artifact instance. This class serves as a base for subclasses that want to carry additional data fields.
    • Constructor Detail

      • DelegatingArtifact

        protected DelegatingArtifact​(Artifact delegate)
        Creates a new artifact instance that delegates to the specified artifact.
        Parameters:
        delegate - The artifact to delegate to, must not be null.
    • Method Detail

      • newInstance

        protected abstract DelegatingArtifact newInstance​(Artifact delegate)
        Creates a new artifact instance that delegates to the specified artifact. Subclasses should use this hook to instantiate themselves, taking along any data from the current instance that was added.
        Parameters:
        delegate - The artifact to delegate to, must not be null.
        Returns:
        The new delegating artifact, never null.
      • getGroupId

        public String getGroupId()
        Description copied from interface: Artifact
        Gets the group identifier of this artifact, for example "org.apache.maven".
        Returns:
        The group identifier, never null.
      • getArtifactId

        public String getArtifactId()
        Description copied from interface: Artifact
        Gets the artifact identifier of this artifact, for example "maven-model".
        Returns:
        The artifact identifier, never null.
      • getVersion

        public String getVersion()
        Description copied from interface: Artifact
        Gets the version of this artifact, for example "1.0-20100529-1213". Note that in case of meta versions like "1.0-SNAPSHOT", the artifact's version depends on the state of the artifact. Artifacts that have been resolved or deployed will usually have the meta version expanded.
        Returns:
        The version, never null.
      • getClassifier

        public String getClassifier()
        Description copied from interface: Artifact
        Gets the classifier of this artifact, for example "sources".
        Returns:
        The classifier or an empty string if none, never null.
      • getExtension

        public String getExtension()
        Description copied from interface: Artifact
        Gets the (file) extension of this artifact, for example "jar" or "tar.gz".
        Returns:
        The file extension (without leading period), never null.
      • getFile

        public File getFile()
        Description copied from interface: Artifact
        Gets the file of this artifact. Note that only resolved artifacts have a file associated with them. In general, callers must not assume any relationship between an artifact's filename and its coordinates.
        Returns:
        The file or null if the artifact isn't resolved.
      • getProperty

        public String getProperty​(String key,
                                  String defaultValue)
        Description copied from interface: Artifact
        Gets the specified property.
        Specified by:
        getProperty in interface Artifact
        Overrides:
        getProperty in class AbstractArtifact
        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.
        See Also:
        ArtifactProperties
      • getProperties

        public Map<String,​StringgetProperties()
        Description copied from interface: Artifact
        Gets the properties of this artifact. Clients may use these properties to associate non-persistent values with an artifact that help later processing when the artifact gets passed around within the application.
        Returns:
        The (read-only) properties, never null.
        See Also:
        ArtifactProperties
      • equals

        public boolean equals​(Object obj)
        Description copied from class: AbstractArtifact
        Compares this artifact with the specified object.
        Overrides:
        equals in class AbstractArtifact
        Parameters:
        obj - The object to compare this artifact against, may be null.
        Returns:
        true if and only if the specified object is another Artifact with equal coordinates, properties and file, false otherwise.