Package org.eclipse.aether.util.artifact
Class SubArtifact
- java.lang.Object
-
- org.eclipse.aether.artifact.AbstractArtifact
-
- org.eclipse.aether.util.artifact.SubArtifact
-
- All Implemented Interfaces:
Artifact
public final class SubArtifact extends AbstractArtifact
An artifact whose identity is derived from another artifact. Note: Instances of this class are immutable and the exposed mutators return new objects rather than changing the current instance.
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Stringclassifierprivate java.lang.Stringextensionprivate java.io.Filefileprivate ArtifactmainArtifactprivate java.util.Map<java.lang.String,java.lang.String>properties
-
Constructor Summary
Constructors Modifier Constructor Description SubArtifact(Artifact mainArtifact, java.lang.String classifier, java.lang.String extension)Creates a new sub artifact.SubArtifact(Artifact mainArtifact, java.lang.String classifier, java.lang.String extension, java.io.File file)Creates a new sub artifact.privateSubArtifact(Artifact mainArtifact, java.lang.String classifier, java.lang.String extension, java.io.File file, java.util.Map<java.lang.String,java.lang.String> properties)SubArtifact(Artifact mainArtifact, java.lang.String classifier, java.lang.String extension, java.util.Map<java.lang.String,java.lang.String> properties)Creates a new sub artifact.SubArtifact(Artifact mainArtifact, java.lang.String classifier, java.lang.String extension, java.util.Map<java.lang.String,java.lang.String> properties, java.io.File file)Creates a new sub artifact.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static java.lang.Stringexpand(java.lang.String pattern, java.lang.String replacement)java.lang.StringgetArtifactId()Gets the artifact identifier of this artifact, for example "maven-model".java.lang.StringgetBaseVersion()Gets the base version of this artifact, for example "1.0-SNAPSHOT".java.lang.StringgetClassifier()Gets the classifier of this artifact, for example "sources".java.lang.StringgetExtension()Gets the (file) extension of this artifact, for example "jar" or "tar.gz".java.io.FilegetFile()Gets the file of this artifact.java.lang.StringgetGroupId()Gets the group identifier of this artifact, for example "org.apache.maven".java.util.Map<java.lang.String,java.lang.String>getProperties()Gets the properties of this artifact.java.lang.StringgetVersion()Gets the version of this artifact, for example "1.0-20100529-1213".booleanisSnapshot()Determines whether this artifact uses a snapshot version.ArtifactsetFile(java.io.File file)Sets the file of the artifact.ArtifactsetProperties(java.util.Map<java.lang.String,java.lang.String> properties)Sets the properties for the artifact.-
Methods inherited from class org.eclipse.aether.artifact.AbstractArtifact
copyProperties, equals, getProperty, hashCode, setVersion, toString
-
-
-
-
Field Detail
-
mainArtifact
private final Artifact mainArtifact
-
classifier
private final java.lang.String classifier
-
extension
private final java.lang.String extension
-
file
private final java.io.File file
-
properties
private final java.util.Map<java.lang.String,java.lang.String> properties
-
-
Constructor Detail
-
SubArtifact
public SubArtifact(Artifact mainArtifact, java.lang.String classifier, java.lang.String extension)
Creates a new sub artifact. The classifier and extension specified for this artifact may use the asterisk character "*" to refer to the corresponding property of the main artifact. For instance, the classifier "*-sources" can be used to refer to the source attachment of an artifact. Likewise, the extension "*.asc" can be used to refer to the GPG signature of an artifact.- Parameters:
mainArtifact- The artifact from which to derive the identity, must not benull.classifier- The classifier for this artifact, may benullif none.extension- The extension for this artifact, may benullif none.
-
SubArtifact
public SubArtifact(Artifact mainArtifact, java.lang.String classifier, java.lang.String extension, java.io.File file)
Creates a new sub artifact. The classifier and extension specified for this artifact may use the asterisk character "*" to refer to the corresponding property of the main artifact. For instance, the classifier "*-sources" can be used to refer to the source attachment of an artifact. Likewise, the extension "*.asc" can be used to refer to the GPG signature of an artifact.- Parameters:
mainArtifact- The artifact from which to derive the identity, must not benull.classifier- The classifier for this artifact, may benullif none.extension- The extension for this artifact, may benullif none.file- The file for this artifact, may benullif unresolved.
-
SubArtifact
public SubArtifact(Artifact mainArtifact, java.lang.String classifier, java.lang.String extension, java.util.Map<java.lang.String,java.lang.String> properties)
Creates a new sub artifact. The classifier and extension specified for this artifact may use the asterisk character "*" to refer to the corresponding property of the main artifact. For instance, the classifier "*-sources" can be used to refer to the source attachment of an artifact. Likewise, the extension "*.asc" can be used to refer to the GPG signature of an artifact.- Parameters:
mainArtifact- The artifact from which to derive the identity, must not benull.classifier- The classifier for this artifact, may benullif none.extension- The extension for this artifact, may benullif none.properties- The properties of the artifact, may benull.
-
SubArtifact
public SubArtifact(Artifact mainArtifact, java.lang.String classifier, java.lang.String extension, java.util.Map<java.lang.String,java.lang.String> properties, java.io.File file)
Creates a new sub artifact. The classifier and extension specified for this artifact may use the asterisk character "*" to refer to the corresponding property of the main artifact. For instance, the classifier "*-sources" can be used to refer to the source attachment of an artifact. Likewise, the extension "*.asc" can be used to refer to the GPG signature of an artifact.- Parameters:
mainArtifact- The artifact from which to derive the identity, must not benull.classifier- The classifier for this artifact, may benullif none.extension- The extension for this artifact, may benullif none.properties- The properties of the artifact, may benull.file- The file for this artifact, may benullif unresolved.
-
SubArtifact
private SubArtifact(Artifact mainArtifact, java.lang.String classifier, java.lang.String extension, java.io.File file, java.util.Map<java.lang.String,java.lang.String> properties)
-
-
Method Detail
-
getGroupId
public java.lang.String getGroupId()
Description copied from interface:ArtifactGets the group identifier of this artifact, for example "org.apache.maven".- Returns:
- The group identifier, never
null.
-
getArtifactId
public java.lang.String getArtifactId()
Description copied from interface:ArtifactGets the artifact identifier of this artifact, for example "maven-model".- Returns:
- The artifact identifier, never
null.
-
getVersion
public java.lang.String getVersion()
Description copied from interface:ArtifactGets 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.
-
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- Overrides:
getBaseVersionin classAbstractArtifact- Returns:
- The base version, never
null.
-
isSnapshot
public boolean isSnapshot()
Description copied from interface:ArtifactDetermines whether this artifact uses a snapshot version.- Specified by:
isSnapshotin interfaceArtifact- Overrides:
isSnapshotin classAbstractArtifact- Returns:
trueif the artifact is a snapshot,falseotherwise.
-
getClassifier
public java.lang.String getClassifier()
Description copied from interface:ArtifactGets the classifier of this artifact, for example "sources".- Returns:
- The classifier or an empty string if none, never
null.
-
getExtension
public java.lang.String getExtension()
Description copied from interface:ArtifactGets the (file) extension of this artifact, for example "jar" or "tar.gz".- Returns:
- The file extension (without leading period), never
null.
-
getFile
public java.io.File getFile()
Description copied from interface:ArtifactGets 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
nullif the artifact isn't resolved.
-
setFile
public Artifact setFile(java.io.File file)
Description copied from interface:ArtifactSets the file of the artifact.- Specified by:
setFilein interfaceArtifact- Overrides:
setFilein classAbstractArtifact- Parameters:
file- The file of the artifact, may benull- Returns:
- The new artifact, never
null.
-
getProperties
public java.util.Map<java.lang.String,java.lang.String> getProperties()
Description copied from interface:ArtifactGets 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
-
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- Overrides:
setPropertiesin classAbstractArtifact- Parameters:
properties- The properties for the artifact, may benull.- Returns:
- The new artifact, never
null. - See Also:
ArtifactProperties
-
expand
private static java.lang.String expand(java.lang.String pattern, java.lang.String replacement)
-
-