Class PropertyVersions

java.lang.Object
org.codehaus.mojo.versions.api.AbstractVersionDetails
org.codehaus.mojo.versions.api.PropertyVersions
All Implemented Interfaces:
VersionDetails

public class PropertyVersions extends AbstractVersionDetails
Manages a property that is associated with one or more artifacts.
Since:
1.0-alpha-3
Author:
Stephen Connolly
  • Method Details

    • getVersionComparator

      public VersionComparator getVersionComparator()
      Gets the rule for version comparison of this artifact.
      Returns:
      the rule for version comparison of this artifact.
      Since:
      1.0-beta-1
    • getAssociations

      public ArtifactAssociation[] getAssociations()
    • getVersions

      public org.apache.maven.artifact.versioning.ArtifactVersion[] getVersions(Collection<org.apache.maven.artifact.Artifact> artifacts)
      Uses the supplied Collection of Artifact instances to see if an ArtifactVersion can be provided.
      Parameters:
      artifacts - The Collection of Artifact instances .
      Returns:
      The versions that can be resolved from the supplied Artifact instances or an empty array if no version can be resolved (i.e. the property is not associated with any of the supplied artifacts or the property is also associated to an artifact that has not been provided).
      Since:
      1.0-alpha-3
    • getVersions

      public org.apache.maven.artifact.versioning.ArtifactVersion[] getVersions(boolean includeSnapshots)
      Uses the DefaultVersionsHelper to find all available versions that match all the associations with this property.
      Parameters:
      includeSnapshots - Whether to include snapshot versions in our search.
      Returns:
      The (possibly empty) array of versions.
    • getName

      public String getName()
    • getProfileId

      public String getProfileId()
    • isAssociated

      public boolean isAssociated()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getNewestVersion

      public org.apache.maven.artifact.versioning.ArtifactVersion getNewestVersion(String currentVersion, Property property, boolean allowSnapshots, List<org.apache.maven.project.MavenProject> reactorProjects, VersionsHelper helper) throws org.apache.maven.artifact.versioning.InvalidVersionSpecificationException, InvalidSegmentException
      Throws:
      org.apache.maven.artifact.versioning.InvalidVersionSpecificationException
      InvalidSegmentException
    • getNewestVersion

      public org.apache.maven.artifact.versioning.ArtifactVersion getNewestVersion(String versionString, Property property, boolean allowSnapshots, Collection<org.apache.maven.project.MavenProject> reactorProjects, VersionsHelper helper, boolean allowDowngrade, Optional<Segment> upperBoundSegment) throws InvalidSegmentException, org.apache.maven.artifact.versioning.InvalidVersionSpecificationException
      Retrieves the newest artifact version for the given property-denoted artifact or null if no newer version could be found.
      Parameters:
      versionString - current version of the artifact
      property - property name indicating the artifact
      allowSnapshots - whether snapshots should be considered
      reactorProjects - collection of reactor projects
      helper - VersionHelper object
      allowDowngrade - whether downgrades should be allowed
      upperBoundSegment - the upper bound segment; empty() means no upper bound
      Returns:
      newest artifact version fulfilling the criteria or null if no newer version could be found
      Throws:
      InvalidSegmentException - thrown if the unchangedSegment is not valid (e.g. greater than the number of segments in the version string)
      org.apache.maven.artifact.versioning.InvalidVersionSpecificationException - thrown if the version string in the property is not valid