Class BoundArtifactVersion
- All Implemented Interfaces:
Comparable<org.apache.maven.artifact.versioning.ArtifactVersion>,org.apache.maven.artifact.versioning.ArtifactVersion
Represents an immutable artifact version with all segments major to the given segment held in place. It can be thought of as an artifact having +∞ as its upper bound on all segments minor to the held segment.
For example:
A BoundArtifactVersion of [1.2.3-2, INCREMENTAL] can be seen as 1.2.+∞
and will be greater than all versions matching the 1.2.* pattern.
A BoundArtifactVersion of [1.2.3-2, SUBINCREMENTAL] will be greater
* than all versions matching the 1.2.3-2.* pattern.
When compared to another artifact versions, this results with the other object with the segment versions up to the held segment being equal, always comparing lower than this object.
This is particularly helpful for -SNAPSHOT and other versions with qualifiers, which are lower than version 0 in the Maven versioning system.
-
Constructor Summary
ConstructorsConstructorDescriptionBoundArtifactVersion(String artifactVersion, Segment segment) Constructs the instance given the version in a text format.BoundArtifactVersion(org.apache.maven.artifact.versioning.ArtifactVersion artifactVersion, Segment segment) Constructs the instance given ainstance -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(org.apache.maven.artifact.versioning.ArtifactVersion other) booleanintintintintReturns the most major segment that can change.inthashCode()voidparseVersion(String version) Deprecated.do not use: this method would mutate the state and therefore is illegal to usetoString()Quasi-contract:toString()must produce the textual representation of the version, without any additional items, this is required by the implementation ofNumericVersionComparator.
-
Constructor Details
-
BoundArtifactVersion
Constructs the instance given the version in a text format.- Parameters:
artifactVersion- lower boundsegment- most major segment that can change, i.e. not held in place
-
BoundArtifactVersion
public BoundArtifactVersion(org.apache.maven.artifact.versioning.ArtifactVersion artifactVersion, Segment segment) Constructs the instance given ainstance- Parameters:
artifactVersion- lower boundsegment- most major segment that can change, i.e. not held in place
-
-
Method Details
-
getSegment
Returns the most major segment that can change. All segments that are more major than this one are held in place.- Returns:
- segment that can change
-
compareTo
public int compareTo(org.apache.maven.artifact.versioning.ArtifactVersion other) - Specified by:
compareToin interfaceComparable<org.apache.maven.artifact.versioning.ArtifactVersion>
-
equals
-
hashCode
public int hashCode() -
getMajorVersion
public int getMajorVersion()- Specified by:
getMajorVersionin interfaceorg.apache.maven.artifact.versioning.ArtifactVersion
-
getMinorVersion
public int getMinorVersion()- Specified by:
getMinorVersionin interfaceorg.apache.maven.artifact.versioning.ArtifactVersion
-
getIncrementalVersion
public int getIncrementalVersion()- Specified by:
getIncrementalVersionin interfaceorg.apache.maven.artifact.versioning.ArtifactVersion
-
getBuildNumber
public int getBuildNumber()- Specified by:
getBuildNumberin interfaceorg.apache.maven.artifact.versioning.ArtifactVersion
-
getQualifier
- Specified by:
getQualifierin interfaceorg.apache.maven.artifact.versioning.ArtifactVersion
-
parseVersion
Deprecated.do not use: this method would mutate the state and therefore is illegal to use- Specified by:
parseVersionin interfaceorg.apache.maven.artifact.versioning.ArtifactVersion- Throws:
UnsupportedOperationException- thrown if the method is called
-
toString
Quasi-contract:toString()must produce the textual representation of the version, without any additional items, this is required by the implementation ofNumericVersionComparator.
-