Class SemanticVersion
- java.lang.Object
-
- net.videki.semver.cc.release.common.SemanticVersion
-
public final class SemanticVersion extends Object
A semantic version representation.
-
-
Field Summary
Fields Modifier and Type Field Description static StringVERSION_SUFFIX_SNAPSHOTVersion suffix for the development version in case of Maven repo layouts.
-
Constructor Summary
Constructors Constructor Description SemanticVersion(int major, int minor, int patch)Constructor to construct a semantic version.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)Check another object for equality with this.StringgetDevelopmentVersionString()Returns the development version as a maven snapshot version, after releasing the current changes.intgetMajor()Returns the major version part of this semantic version.intgetMinor()Returns the minor part of this semantic version.intgetPatch()Returns the patch version part of this semantic version.inthashCode()Hashcode for the class.SemanticVersionnextDevelopmentVersion(SemanticVersionChange change)Calculates and returns the development version to be setup after the next release by the maven release plugin, based on the given change type.static SemanticVersionparse(String version)Factory method to parse a string formatted semantic version and construct a semantic version object.SemanticVersionreleaseVersion(SemanticVersionChange change)Calculates and returns the next semantic version based on the given change.StringtoString()toString for this version.
-
-
-
Field Detail
-
VERSION_SUFFIX_SNAPSHOT
public static final String VERSION_SUFFIX_SNAPSHOT
Version suffix for the development version in case of Maven repo layouts.- See Also:
- Constant Field Values
-
-
Method Detail
-
equals
public boolean equals(Object o)
Check another object for equality with this.
-
hashCode
public int hashCode()
Hashcode for the class.
-
getMajor
public int getMajor()
Returns the major version part of this semantic version.- Returns:
- The major version part.
-
getMinor
public int getMinor()
Returns the minor part of this semantic version.- Returns:
- The minor version part.
-
getPatch
public int getPatch()
Returns the patch version part of this semantic version.- Returns:
- The patch version part.
-
releaseVersion
public SemanticVersion releaseVersion(SemanticVersionChange change)
Calculates and returns the next semantic version based on the given change.- Parameters:
change- The change (major, minor...).- Returns:
- The adjusted semantic version.
-
nextDevelopmentVersion
public SemanticVersion nextDevelopmentVersion(SemanticVersionChange change)
Calculates and returns the development version to be setup after the next release by the maven release plugin, based on the given change type.- Parameters:
change- The version change (major, minor, ...)- Returns:
- The calculated version change.
-
toString
public String toString()
toString for this version.
-
parse
public static SemanticVersion parse(String version)
Factory method to parse a string formatted semantic version and construct a semantic version object.- Parameters:
version- The version string.- Returns:
- The semantic version object, or IllegalArgumentException is thrown.
-
getDevelopmentVersionString
public String getDevelopmentVersionString()
Returns the development version as a maven snapshot version, after releasing the current changes.- Returns:
- The version string to be used as the next snapshot version in case of maven repo layouts.
-
-