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.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `SubArtifact(Artifact mainArtifact, String classifier, String extension)` Creates a new sub artifact.
    `SubArtifact(Artifact mainArtifact, String classifier, String extension, File file)` Creates a new sub artifact.
    `SubArtifact(Artifact mainArtifact, String classifier, String extension, Map<String,String> properties)` Creates a new sub artifact.
    `SubArtifact(Artifact mainArtifact, String classifier, String extension, Map<String,String> properties, File file)` Creates a new sub artifact.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `getArtifactId()` Gets the artifact identifier of this artifact, for example "maven-model".
    `String` | `getBaseVersion()` Gets the base version of this artifact, for example "1.0-SNAPSHOT".
    `String` | `getClassifier()` Gets the classifier of this artifact, for example "sources".
    `String` | `getExtension()` Gets the (file) extension of this artifact, for example "jar" or "tar.gz".
    `File` | `getFile()` Gets the file of this artifact.
    `String` | `getGroupId()` Gets the group identifier of this artifact, for example "org.apache.maven".
    `Map<String,String>` | `getProperties()` Gets the properties of this artifact.
    `String` | `getVersion()` Gets the version of this artifact, for example "1.0-20100529-1213".
    `boolean` | `isSnapshot()` Determines whether this artifact uses a snapshot version.
    `Artifact` | `setFile(File file)` Sets the file of the artifact.
    `Artifact` | `setProperties(Map<String,String> properties)` Sets the properties for the artifact.

    - ### Methods inherited from class org.eclipse.aether.artifact.AbstractArtifact

      `copyProperties, equals, getProperty, hashCode, setVersion, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### SubArtifact

          public SubArtifact(Artifact mainArtifact,
                     String classifier,
                     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 be `null`.
        `classifier` - The classifier for this artifact, may be `null` if none.
        `extension` - The extension for this artifact, may be `null` if none.

    - #### SubArtifact

          public SubArtifact(Artifact mainArtifact,
                     String classifier,
                     String extension,
                     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 be `null`.
        `classifier` - The classifier for this artifact, may be `null` if none.
        `extension` - The extension for this artifact, may be `null` if none.
        `file` - The file for this artifact, may be `null` if unresolved.

    - #### SubArtifact

          public SubArtifact(Artifact mainArtifact,
                     String classifier,
                     String extension,
                     Map<String,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 be `null`.
        `classifier` - The classifier for this artifact, may be `null` if none.
        `extension` - The extension for this artifact, may be `null` if none.
        `properties` - The properties of the artifact, may be `null`.

    - #### SubArtifact

          public SubArtifact(Artifact mainArtifact,
                     String classifier,
                     String extension,
                     Map<String,String> properties,
                     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 be `null`.
        `classifier` - The classifier for this artifact, may be `null` if none.
        `extension` - The extension for this artifact, may be `null` if none.
        `properties` - The properties of the artifact, may be `null`.
        `file` - The file for this artifact, may be `null` if unresolved.

  - ### Method Detail

    - #### 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`.

    - #### getBaseVersion

          public 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`
      Overrides:
        `getBaseVersion` in class `AbstractArtifact`
      Returns:
        The base version, never `null`.

    - #### isSnapshot

          public boolean isSnapshot()

      Description copied from interface: `Artifact`
      Determines whether this artifact uses a snapshot version.
      Specified by:
        `isSnapshot` in interface `Artifact`
      Overrides:
        `isSnapshot` in class `AbstractArtifact`
      Returns:
        `true` if the artifact is a snapshot, `false` otherwise.

    - #### 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.

    - #### setFile

          public Artifact setFile(File file)

      Description copied from interface: `Artifact`
      Sets the file of the artifact.
      Specified by:
        `setFile` in interface `Artifact`
      Overrides:
        `setFile` in class `AbstractArtifact`
      Parameters:
        `file` - The file of the artifact, may be `null`
      Returns:
        The new artifact, never `null`.

    - #### getProperties

          public Map<String,String> getProperties()

      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`

    - #### setProperties

          public Artifact setProperties(Map<String,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`
      Overrides:
        `setProperties` in class `AbstractArtifact`
      Parameters:
        `properties` - The properties for the artifact, may be `null`.
      Returns:
        The new artifact, never `null`.
      See Also:
        `ArtifactProperties`

Copyright © 2010-2014 The Eclipse Foundation. All Rights Reserved.