Package org.eclipse.aether.artifact
Class AbstractArtifact
- java.lang.Object
-
- org.eclipse.aether.artifact.AbstractArtifact
-
- All Implemented Interfaces:
Artifact
- Direct Known Subclasses:
DefaultArtifact
public abstract class AbstractArtifact extends java.lang.Object implements Artifact
A skeleton class for artifacts.
-
-
Constructor Summary
Constructors Constructor Description AbstractArtifact()Constructor for subclasses.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated 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.booleanequals(java.lang.Object obj)Compares this artifact with the specified object.java.lang.StringgetBaseVersion()Gets the base version of this artifact, for example "1.0-SNAPSHOT".java.nio.file.PathgetPath()This method should (and in Resolver is) overridden, but is kept just to preserve backward compatibility if this class is extended somewhere.java.lang.StringgetProperty(java.lang.String key, java.lang.String defaultValue)Gets the specified property.inthashCode()Returns a hash code for this artifact.booleanisSnapshot()Determines whether this artifact uses a snapshot version.ArtifactsetFile(java.io.File file)Deprecated.ArtifactsetPath(java.nio.file.Path path)Sets the file of the artifact.ArtifactsetProperties(java.util.Map<java.lang.String,java.lang.String> properties)Sets the properties for the artifact.ArtifactsetVersion(java.lang.String version)Sets the version of the artifact.java.lang.StringtoString()-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.aether.artifact.Artifact
getArtifactId, getClassifier, getExtension, getFile, getGroupId, getProperties, getVersion
-
-
-
-
Constructor Detail
-
AbstractArtifact
public AbstractArtifact()
Constructor for subclasses.
-
-
Method Detail
-
isSnapshot
public boolean isSnapshot()
Description copied from interface:ArtifactDetermines whether this artifact uses a snapshot version.- Specified by:
isSnapshotin interfaceArtifact- Returns:
trueif the artifact is a snapshot,falseotherwise.
-
getBaseVersion
public java.lang.String getBaseVersion()
Description copied from interface:ArtifactGets the base version of this artifact, for example "1.0-SNAPSHOT". In contrast to theArtifact.getVersion(), the base version will always refer to the unresolved meta version.- Specified by:
getBaseVersionin interfaceArtifact- Returns:
- The base version, never
null.
-
setVersion
public Artifact setVersion(java.lang.String version)
Description copied from interface:ArtifactSets the version of the artifact.- Specified by:
setVersionin interfaceArtifact- Parameters:
version- The version of this artifact, may benullor empty.- Returns:
- The new artifact, never
null.
-
getPath
public java.nio.file.Path getPath()
This method should (and in Resolver is) overridden, but is kept just to preserve backward compatibility if this class is extended somewhere. It delegates to the deprecatedArtifact.getFile()on purpose, as that is the method such a subclass implements.
-
setFile
@Deprecated public Artifact setFile(java.io.File file)
Deprecated.Description copied from interface:ArtifactSets the file of the artifact.
-
setPath
public Artifact setPath(java.nio.file.Path path)
Description copied from interface:ArtifactSets the file of the artifact.
-
setProperties
public Artifact setProperties(java.util.Map<java.lang.String,java.lang.String> properties)
Description copied from interface:ArtifactSets 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:
setPropertiesin interfaceArtifact- Parameters:
properties- The properties for the artifact, may benull.- 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:ArtifactGets the specified property.- Specified by:
getPropertyin interfaceArtifact- 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
nullif 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 benull.- Returns:
- The copied and read-only properties, never
null.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
Compares this artifact with the specified object.- Overrides:
equalsin classjava.lang.Object- Parameters:
obj- The object to compare this artifact against, may benull.- Returns:
trueif and only if the specified object is anotherArtifactwith equal coordinates, properties and file,falseotherwise.
-
hashCode
public int hashCode()
Returns a hash code for this artifact.- Overrides:
hashCodein classjava.lang.Object- Returns:
- A hash code for the artifact.
-
-