Package ch.tocco.nice2.toolbox.api
Class Nice2Version
java.lang.Object
ch.tocco.nice2.toolbox.api.Nice2Version
- All Implemented Interfaces:
Comparable<Nice2Version>
This immutable class represents the nice2 version scheme as described here.
The version consists of four parts, where the last two are optional and default to 0 if not defined explicitely.
Version String:
major . minor . fix . buildnumber
2 1 1 32
The major part must be greater than 0, all other parts must not be lower than 0. Valid version strings:
2.1
2.1.0
2.1.0.12
The major and minor parts are mandatory. The fix and buildnumber part need not be specified and are considered to be 0 then. The build number is a number that is incremented on each subsequent build, no matter if there was a change introduced or not.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionNice2Version(int major, int minor) Nice2Version(int major, int minor, int fix) Nice2Version(int major, int minor, int fix, int buildnumber) Nice2Version(String version) -
Method Summary
Modifier and TypeMethodDescriptionintbooleanstatic Optional<Nice2Version> findVersion(String str) Attemps to find a substring that matches the version pattern and returns it parsed to a version object.intstatic Optional<Nice2Version> Gets the current nice2 version.intgetFix()intgetMajor()intgetMinor()inthashCode()toString()static Optional<Nice2Version> tryGetVersion(String version) withBuildNumber(int buildnumber) withBuildNumberAdded(int arg) withFix(int fix) withFixAdded(int arg) withMajor(int major) withMajorAdded(int arg) withMinor(int minor) withMinorAdded(int arg)
-
Field Details
-
PROPERTY
- See Also:
-
REVISION_PROPERTY
- See Also:
-
-
Constructor Details
-
Nice2Version
public Nice2Version(int major, int minor, int fix, int buildnumber) -
Nice2Version
public Nice2Version(int major, int minor, int fix) -
Nice2Version
public Nice2Version(int major, int minor) -
Nice2Version
-
-
Method Details
-
tryGetVersion
-
findVersion
Attemps to find a substring that matches the version pattern and returns it parsed to a version object. -
getCurrent
Gets the current nice2 version. At first, the system propertynice2.versionis examined. -
getCurrentRevision
-
getMajor
public int getMajor() -
getMinor
public int getMinor() -
getFix
public int getFix() -
getBuildnumber
public int getBuildnumber() -
asCompleteString
-
asShortString
-
withBuildNumber
-
withBuildNumberAdded
-
withFix
-
withFixAdded
-
withMinor
-
withMinorAdded
-
withMajor
-
withMajorAdded
-
equals
-
hashCode
public int hashCode() -
toString
-
compareTo
- Specified by:
compareToin interfaceComparable<Nice2Version>
-