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 TypeMethodDescriptionint
boolean
int
getMajor()
Returns the major part of the version.int
getMinor()
Returns the minor part of the version.Returns the string representation of the parsed version.int
getPatch()
Returns the patch part of the version.getType()
Returns the version type (alpha, beta, milestone, etc.) of the version.int
Returns the version of the type e.g.Returns the unparsed string representation of the version.int
hashCode()
boolean
Returns true if the given version is newer.boolean
Returns true if the given version is newer.boolean
isNewerOrEqual
(String versionString) Returns true if the given version is newer or equal.boolean
Returns true if the given version is newer or equal.boolean
Returns true if the given version is older.boolean
Returns true if the given version is older.boolean
isOlderOrEqual
(String versionString) Returns true if the given version is older or equal.boolean
Returns true if the given version is older or equal.boolean
Returns true if the version is a snapshot.static Version
Creates 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:
compareTo
in 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.
-