Package i5.las2peer.api
Class SemverVersion
java.lang.Object
i5.las2peer.api.SemverVersion
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
LibraryVersion
,ServiceVersion
A simple class managing a semantic version number in the format
<major> "." <minor> "." <patch> "-" <pre-release> "+" <build>
(where minor, patch, pre-release and build
are optional) or "*" (no version specified / matches all versions).- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSemverVersion
(int major) generate a new ServiceVersionSemverVersion
(int major, int minor) generate a new ServiceVersionSemverVersion
(int major, int minor, int patch) generate a new ServiceVersionSemverVersion
(int major, int minor, int patch, String preRelease) generate a new ServiceVersionSemverVersion
(int major, int minor, int patch, String preRelease, String build) generate a new ServiceVersionSemverVersion
(String version) Generate a Version from String representation format : Semver<major> "." <minor> "." <patch> "-" <pre-release> "+" <build>
(where minor, patch, pre-release and build are optional) or "*" (no version specified / matches all versions) -
Method Summary
Modifier and TypeMethodDescriptionboolean
compares to version and checks for equalityboolean
compares this version with any object if the given object is a String, the string representation of this version is compared to the given stringgetBuild()
get the build number of this (patch)versionint
getMajor()
get the major version numberint
getMinor()
get the minor version numberint
getPatch()
get the patch version of the minor version numberint
getSub()
Deprecated.int
hashCode()
since equals is overridden, we should implement an own hashCode.toString()
-
Field Details
-
major
-
minor
-
patch
-
build
-
preRelease
-
-
Constructor Details
-
SemverVersion
Generate a Version from String representation format : Semver<major> "." <minor> "." <patch> "-" <pre-release> "+" <build>
(where minor, patch, pre-release and build are optional) or "*" (no version specified / matches all versions)- Parameters:
version
- A version string representation to parse- Throws:
IllegalArgumentException
- If the string contains no valid version representation
-
SemverVersion
public SemverVersion(int major, int minor, int patch, String preRelease, String build) throws IllegalArgumentException generate a new ServiceVersion- Parameters:
major
- Major version number partminor
- Minor version number partpatch
- Patch version number partpreRelease
- pre-release versionbuild
- build version- Throws:
IllegalArgumentException
- If a version number part is smaller than 0
-
SemverVersion
public SemverVersion(int major, int minor, int patch, String preRelease) throws IllegalArgumentException generate a new ServiceVersion- Parameters:
major
- Major version number partminor
- Minor version number partpatch
- Patch version number partpreRelease
- pre-release version- Throws:
IllegalArgumentException
- If a version number part is smaller than 0
-
SemverVersion
generate a new ServiceVersion- Parameters:
major
- Major version number partminor
- Minor version number partpatch
- Patch version number part- Throws:
IllegalArgumentException
- If a version number part is smaller than 0
-
SemverVersion
generate a new ServiceVersion- Parameters:
major
- Major version number partminor
- Minor version number part- Throws:
IllegalArgumentException
- If a version number part is smaller than 0
-
SemverVersion
generate a new ServiceVersion- Parameters:
major
- Major version number part- Throws:
IllegalArgumentException
- If a version number part is smaller than 0
-
-
Method Details
-
equals
compares to version and checks for equality- Parameters:
v
- Another service version to compare to- Returns:
- true, if this version is the same as the given one
-
equals
compares this version with any object if the given object is a String, the string representation of this version is compared to the given string -
hashCode
public int hashCode()since equals is overridden, we should implement an own hashCode. -
getMinor
public int getMinor()get the minor version number- Returns:
- minor version number
-
getMajor
public int getMajor()get the major version number- Returns:
- major version number
-
getPatch
public int getPatch()get the patch version of the minor version number- Returns:
- patch version number of minor
-
getSub
public int getSub()Deprecated.usegetPatch()
insteadget the subversion of the minor version number- Returns:
- subversion number of minor
-
getBuild
get the build number of this (patch)version- Returns:
- build number
-
getPreRelease
-
toString
-
getPatch()
instead