public abstract class AbstractArtifact extends java.lang.Object implements Artifact
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
SNAPSHOT |
private static java.util.regex.Pattern |
SNAPSHOT_TIMESTAMP |
Constructor and Description |
---|
AbstractArtifact() |
Modifier and Type | Method and 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.
|
private static <T> boolean |
eq(T s1,
T s2) |
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() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getArtifactId, getClassifier, getExtension, getFile, getGroupId, getProperties, getVersion
private static final java.lang.String SNAPSHOT
private static final java.util.regex.Pattern SNAPSHOT_TIMESTAMP
public boolean isSnapshot()
Artifact
isSnapshot
in interface Artifact
true
if the artifact is a snapshot, false
otherwise.private static boolean isSnapshot(java.lang.String version)
public java.lang.String getBaseVersion()
Artifact
Artifact.getVersion()
, the
base version will always refer to the unresolved meta version.getBaseVersion
in interface Artifact
null
.private static java.lang.String toBaseVersion(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)
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
.null
.public Artifact setVersion(java.lang.String version)
Artifact
setVersion
in interface Artifact
version
- The version of this artifact, may be null
or empty.null
.public Artifact setFile(java.io.File file)
Artifact
public Artifact setProperties(java.util.Map<java.lang.String,java.lang.String> properties)
Artifact
setProperties
in interface Artifact
properties
- The properties for the artifact, may be null
.null
.ArtifactProperties
public java.lang.String getProperty(java.lang.String key, java.lang.String defaultValue)
Artifact
getProperty
in interface Artifact
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
.null
if the property is not set and no default value was
provided.ArtifactProperties
protected static java.util.Map<java.lang.String,java.lang.String> copyProperties(java.util.Map<java.lang.String,java.lang.String> properties)
properties
- The properties to copy, may be null
.null
.public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- The object to compare this artifact against, may be null
.true
if and only if the specified object is another Artifact
with equal coordinates,
properties and file, false
otherwise.private static <T> boolean eq(T s1, T s2)
public int hashCode()
hashCode
in class java.lang.Object
private static int hash(java.lang.Object obj)