Class AbstractArtifact

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.lang.String SNAPSHOT  
      private static java.util.regex.Pattern SNAPSHOT_TIMESTAMP  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected static java.util.Map<java.lang.String,​java.lang.String> copyProperties​(java.util.Map<java.lang.String,​java.lang.String> properties)
      Copies the specified artifact properties.
      boolean equals​(java.lang.Object obj)
      Compares this artifact with the specified object.
      java.lang.String getBaseVersion()
      Gets the base version of this artifact, for example "1.0-SNAPSHOT".
      java.lang.String getProperty​(java.lang.String key, java.lang.String defaultValue)
      Gets the specified property.
      private static int hash​(java.lang.Object obj)  
      int hashCode()
      Returns a hash code for this artifact.
      boolean isSnapshot()
      Determines whether this artifact uses a snapshot version.
      private static boolean isSnapshot​(java.lang.String version)  
      private Artifact newInstance​(java.lang.String version, java.util.Map<java.lang.String,​java.lang.String> properties, java.io.File file)
      Creates a new artifact with the specified coordinates, properties and file.
      Artifact setFile​(java.io.File file)
      Sets the file of the artifact.
      Artifact setProperties​(java.util.Map<java.lang.String,​java.lang.String> properties)
      Sets the properties for the artifact.
      Artifact setVersion​(java.lang.String version)
      Sets the version of the artifact.
      private static java.lang.String toBaseVersion​(java.lang.String version)  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • SNAPSHOT_TIMESTAMP

        private static final java.util.regex.Pattern SNAPSHOT_TIMESTAMP
    • Constructor Detail

      • AbstractArtifact

        public AbstractArtifact()
    • Method Detail

      • isSnapshot

        public boolean isSnapshot()
        Description copied from interface: Artifact
        Determines whether this artifact uses a snapshot version.
        Specified by:
        isSnapshot in interface Artifact
        Returns:
        true if the artifact is a snapshot, false otherwise.
      • isSnapshot

        private static boolean isSnapshot​(java.lang.String version)
      • getBaseVersion

        public java.lang.String getBaseVersion()
        Description copied from interface: Artifact
        Gets the base version of this artifact, for example "1.0-SNAPSHOT". In contrast to the Artifact.getVersion(), the base version will always refer to the unresolved meta version.
        Specified by:
        getBaseVersion in interface Artifact
        Returns:
        The base version, never null.
      • toBaseVersion

        private static java.lang.String toBaseVersion​(java.lang.String version)
      • newInstance

        private Artifact newInstance​(java.lang.String version,
                                     java.util.Map<java.lang.String,​java.lang.String> properties,
                                     java.io.File file)
        Creates a new artifact with the specified coordinates, properties and file.
        Parameters:
        version - The version of the artifact, may be null.
        properties - The properties of the artifact, may be null if none. The method may assume immutability of the supplied map, i.e. need not copy it.
        file - The resolved file of the artifact, may be null.
        Returns:
        The new artifact instance, never null.
      • setVersion

        public Artifact setVersion​(java.lang.String version)
        Description copied from interface: Artifact
        Sets the version of the artifact.
        Specified by:
        setVersion in interface Artifact
        Parameters:
        version - The version of this artifact, may be null or empty.
        Returns:
        The new artifact, never null.
      • setFile

        public Artifact setFile​(java.io.File file)
        Description copied from interface: Artifact
        Sets the file of the artifact.
        Specified by:
        setFile in interface Artifact
        Parameters:
        file - The file of the artifact, may be null
        Returns:
        The new artifact, never null.
      • setProperties

        public Artifact setProperties​(java.util.Map<java.lang.String,​java.lang.String> properties)
        Description copied from interface: Artifact
        Sets the properties for the artifact. Note that these properties exist merely in memory and are not persisted when the artifact gets installed/deployed to a repository.
        Specified by:
        setProperties in interface Artifact
        Parameters:
        properties - The properties for the artifact, may be null.
        Returns:
        The new artifact, never null.
        See Also:
        ArtifactProperties
      • getProperty

        public java.lang.String getProperty​(java.lang.String key,
                                            java.lang.String defaultValue)
        Description copied from interface: Artifact
        Gets the specified property.
        Specified by:
        getProperty in interface Artifact
        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
      • copyProperties

        protected static java.util.Map<java.lang.String,​java.lang.String> copyProperties​(java.util.Map<java.lang.String,​java.lang.String> properties)
        Copies the specified artifact properties. This utility method should be used when creating new artifact instances with caller-supplied properties.
        Parameters:
        properties - The properties to copy, may be null.
        Returns:
        The copied and read-only properties, never null.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Compares this artifact with the specified object.
        Overrides:
        equals in class java.lang.Object
        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.
      • hashCode

        public int hashCode()
        Returns a hash code for this artifact.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        A hash code for the artifact.
      • hash

        private static int hash​(java.lang.Object obj)