Package com.github.zafarkhaja.semver
Class NormalVersion
- java.lang.Object
-
- com.github.zafarkhaja.semver.NormalVersion
-
- All Implemented Interfaces:
java.lang.Comparable<NormalVersion>
class NormalVersion extends java.lang.Object implements java.lang.Comparable<NormalVersion>
TheNormalVersion
class represents the version core. This class is immutable and hence thread-safe.- Since:
- 0.2.0
-
-
Constructor Summary
Constructors Constructor Description NormalVersion(int major, int minor, int patch)
Constructs aNormalVersion
with the major, minor and patch version numbers.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(NormalVersion other)
boolean
equals(java.lang.Object other)
(package private) int
getMajor()
Returns the major version number.(package private) int
getMinor()
Returns the minor version number.(package private) int
getPatch()
Returns the patch version number.int
hashCode()
(package private) NormalVersion
incrementMajor()
Increments the major version number.(package private) NormalVersion
incrementMinor()
Increments the minor version number.(package private) NormalVersion
incrementPatch()
Increments the patch version number.java.lang.String
toString()
Returns the string representation of this normal version.
-
-
-
Constructor Detail
-
NormalVersion
NormalVersion(int major, int minor, int patch)
Constructs aNormalVersion
with the major, minor and patch version numbers.- Parameters:
major
- the major version numberminor
- the minor version numberpatch
- the patch version number- Throws:
java.lang.IllegalArgumentException
- if one of the version numbers is a negative integer
-
-
Method Detail
-
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
NormalVersion
class
-
incrementMinor
NormalVersion incrementMinor()
Increments the minor version number.- Returns:
- a new instance of the
NormalVersion
class
-
incrementPatch
NormalVersion incrementPatch()
Increments the patch version number.- Returns:
- a new instance of the
NormalVersion
class
-
compareTo
public int compareTo(NormalVersion other)
- Specified by:
compareTo
in interfacejava.lang.Comparable<NormalVersion>
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String 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)- Overrides:
toString
in classjava.lang.Object
- Returns:
- the string representation of this normal version
-
-