Class NormalVersion
java.lang.Object
com.github.zafarkhaja.semver.NormalVersion
- All Implemented Interfaces:
Comparable<NormalVersion>
The
NormalVersion class represents the version core.
This class is immutable and hence thread-safe.- Since:
- 0.2.0
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionNormalVersion(int major, int minor, int patch) Constructs aNormalVersionwith the major, minor and patch version numbers. -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(NormalVersion other) boolean(package private) intgetMajor()Returns the major version number.(package private) intgetMinor()Returns the minor version number.(package private) intgetPatch()Returns the patch version number.inthashCode()(package private) NormalVersionIncrements the major version number.(package private) NormalVersionIncrements the minor version number.(package private) NormalVersionIncrements the patch version number.toString()Returns the string representation of this normal version.
-
Field Details
-
major
private final int majorThe major version number. -
minor
private final int minorThe minor version number. -
patch
private final int patchThe patch version number.
-
-
Constructor Details
-
NormalVersion
NormalVersion(int major, int minor, int patch) Constructs aNormalVersionwith the major, minor and patch version numbers.- Parameters:
major- the major version numberminor- the minor version numberpatch- the patch version number- Throws:
IllegalArgumentException- if one of the version numbers is a negative integer
-
-
Method Details
-
getMajor
int getMajor()Returns the major version number.- Returns:
- the major version number
-
getMinor
int getMinor()Returns the minor version number.- Returns:
- the minor version number
-
getPatch
int getPatch()Returns the patch version number.- Returns:
- the patch version number
-
incrementMajor
NormalVersion incrementMajor()Increments the major version number.- Returns:
- a new instance of the
NormalVersionclass
-
incrementMinor
NormalVersion incrementMinor()Increments the minor version number.- Returns:
- a new instance of the
NormalVersionclass
-
incrementPatch
NormalVersion incrementPatch()Increments the patch version number.- Returns:
- a new instance of the
NormalVersionclass
-
compareTo
- Specified by:
compareToin interfaceComparable<NormalVersion>
-
equals
-
hashCode
-
toString
Returns the string representation of this normal version. A normal version number MUST take the form X.Y.Z where X, Y, and Z are non-negative integers. X is the major version, Y is the minor version, and Z is the patch version. (SemVer p.2)
-