Package sonia.scm.version
Class Version
java.lang.Object
sonia.scm.version.Version
- All Implemented Interfaces:
Comparable<Version>
Version object for comparing and parsing versions.
-
Method Summary
Modifier and TypeMethodDescriptionintbooleanintgetMajor()Returns the major part of the version.intgetMinor()Returns the minor part of the version.Returns the string representation of the parsed version.intgetPatch()Returns the patch part of the version.getType()Returns the version type (alpha, beta, milestone, etc.) of the version.intReturns the version of the type e.g.Returns the unparsed string representation of the version.inthashCode()booleanReturns true if the given version is newer.booleanReturns true if the given version is newer.booleanisNewerOrEqual(String versionString) Returns true if the given version is newer or equal.booleanReturns true if the given version is newer or equal.booleanReturns true if the given version is older.booleanReturns true if the given version is older.booleanisOlderOrEqual(String versionString) Returns true if the given version is older or equal.booleanReturns true if the given version is older or equal.booleanReturns true if the version is a snapshot.static VersionCreates a new version of the given string.toString()
-
Method Details
-
parse
Creates a new version of the given string.- Parameters:
versionString- string representation of the version- Returns:
- version object
-
compareTo
- Specified by:
compareToin interfaceComparable<Version>
-
equals
-
hashCode
public int hashCode() -
toString
-
getMajor
public int getMajor()Returns the major part of the version. -
getMinor
public int getMinor()Returns the minor part of the version. -
getParsedVersion
Returns the string representation of the parsed version. -
getPatch
public int getPatch()Returns the patch part of the version. -
getType
Returns the version type (alpha, beta, milestone, etc.) of the version.- Returns:
- version type
-
getTypeVersion
public int getTypeVersion()Returns the version of the type e.g. beta-1 would return 1.- Returns:
- version of the type
-
getUnparsedVersion
Returns the unparsed string representation of the version. -
isNewer
Returns true if the given version is newer. -
isNewer
Returns true if the given version is newer. -
isNewerOrEqual
Returns true if the given version is newer or equal.- Since:
- 2.4.0
-
isNewerOrEqual
Returns true if the given version is newer or equal.- Since:
- 2.4.0
-
isOlder
Returns true if the given version is older. -
isOlder
Returns true if the given version is older. -
isOlderOrEqual
Returns true if the given version is older or equal.- Since:
- 2.4.0
-
isOlderOrEqual
Returns true if the given version is older or equal.- Since:
- 2.4.0
-
isSnapshot
public boolean isSnapshot()Returns true if the version is a snapshot.
-