Package org.forgerock.openig.tools.am
Class Version
java.lang.Object
org.forgerock.openig.tools.am.Version
- All Implemented Interfaces:
Comparable<Version>
- Direct Known Subclasses:
AmVersion
Supports version with the following format: major[.minor[.micro]].
Components described as follows:
- major: positive integer, mandatory, the major version number (such as 5 or 13)
- minor: positive integer, optional, the minor version number
- micro: positive integer, optional, the micro version number
This class implements the Comparable
interface in order to ease natural ordering of versions.
Note that qualifier is not part of the comparison.
-
Constructor Summary
ModifierConstructorDescriptionprotected
Version
(int major, int minor, int micro) Constructs a new Version from its given components. -
Method Summary
Modifier and TypeMethodDescriptionReturns a predicate that verifies if this version is in between the givenminInclusive
andmaxInclusive
versions (inclusive).int
boolean
Returns a predicate that verifies strict equality.greaterThan
(Version version) Returns a predicate that verifies if this version is strictly greater than the givenversion
.greaterThanOrEqualTo
(Version version) Returns a predicate that verifies if this version is greater or equal to the givenversion
.int
hashCode()
boolean
Returnstrue
if this version satisfy the given predicate.Returns a predicate that verifies if this version is strictly lower than the givenversion
.lowerThanOrEqualTo
(Version version) Returns a predicate that verifies if this version is lower or equal to the givenversion
.int
major()
Returns major component of the version.int
micro()
Returns micro component of the version.int
minor()
Returns minor component of the version.static Version
Parse an input string, decomposing it in its base elements (major, minor, micro).strictlyBetween
(Version minExclusive, Version maxExclusive) Returns a predicate that verifies if this version is in between the givenminExclusive
andmaxExclusive
versions (exclusive).toString()
static Version
v
(int major) Builds a version from its components (minor set to0
, micro set to0
, no qualifier).static Version
v
(int major, int minor) Builds a version from its components (micro set to0
, no qualifier).static Version
v
(int major, int minor, int micro) Builds a version from its components.
-
Constructor Details
-
Version
protected Version(int major, int minor, int micro) Constructs a new Version from its given components.- Parameters:
major
- major version numberminor
- minor version numbermicro
- micro version number
-
-
Method Details
-
of
Parse an input string, decomposing it in its base elements (major, minor, micro).- Parameters:
in
- version as a string- Returns:
- the corresponding version
-
v
Builds a version from its components (minor set to0
, micro set to0
, no qualifier).- Parameters:
major
- major version number- Returns:
- a version
-
v
Builds a version from its components (micro set to0
, no qualifier).- Parameters:
major
- major version numberminor
- minor version number- Returns:
- a version
-
v
Builds a version from its components.- Parameters:
major
- major version numberminor
- minor version numbermicro
- micro version number- Returns:
- a version
-
major
public int major()Returns major component of the version.- Returns:
- major component of the version.
-
minor
public int minor()Returns minor component of the version.- Returns:
- minor component of the version.
-
micro
public int micro()Returns micro component of the version.- Returns:
- micro component of the version.
-
is
Returnstrue
if this version satisfy the given predicate.- Parameters:
predicate
- the assertion tested against this version- Returns:
- true if the assertion is satisfied, false otherwise
-
equalTo
Returns a predicate that verifies strict equality.- Parameters:
version
- expected version- Returns:
- a predicate that verifies strict equality.
-
greaterThan
Returns a predicate that verifies if this version is strictly greater than the givenversion
.- Parameters:
version
- expected version- Returns:
- a predicate that verifies if this version is strictly greater than the given
version
.
-
greaterThanOrEqualTo
Returns a predicate that verifies if this version is greater or equal to the givenversion
.- Parameters:
version
- expected version- Returns:
- a predicate that verifies if this version is greater or equal to the given
version
.
-
lowerThan
Returns a predicate that verifies if this version is strictly lower than the givenversion
.- Parameters:
version
- expected version- Returns:
- a predicate that verifies if this version is strictly lower than the given
version
.
-
lowerThanOrEqualTo
Returns a predicate that verifies if this version is lower or equal to the givenversion
.- Parameters:
version
- expected version- Returns:
- a predicate that verifies if this version is lower or equal to the given
version
.
-
between
Returns a predicate that verifies if this version is in between the givenminInclusive
andmaxInclusive
versions (inclusive).- Parameters:
minInclusive
- minimum versionmaxInclusive
- maximum version- Returns:
- a predicate that verifies if this version is in between the given versions (inclusive)
-
strictlyBetween
Returns a predicate that verifies if this version is in between the givenminExclusive
andmaxExclusive
versions (exclusive).- Parameters:
minExclusive
- minimum versionmaxExclusive
- maximum version- Returns:
- a predicate that verifies if this version is in between the given versions (exclusive)
-
compareTo
- Specified by:
compareTo
in interfaceComparable<Version>
-
toString
-
equals
-
hashCode
public int hashCode()
-