Package org.forgerock.http.routing
Class Version
java.lang.Object
org.forgerock.http.routing.Version
- All Implemented Interfaces:
Comparable<Version>
Represents some version in the form majorNumber.minorNumber,
for instance 2.4.
-
Method Summary
Modifier and TypeMethodDescriptionint
boolean
int
getMajor()
Returns the major version number.int
getMinor()
Returns the minor version number.int
hashCode()
boolean
isCompatibleWith
(Version that) Returnsfalse
if: the MAJOR version numbers are not the same.toString()
static Version
version
(int major) Creates a new version using the provided version information and a minor.static Version
version
(int major, int minor) Creates a new version using the provided version information.static Version
Parses the string argument as a version.
-
Method Details
-
version
Creates a new version using the provided version information.- Parameters:
major
- Major version number.minor
- Minor version number.- Returns:
- The version.
-
version
Creates a new version using the provided version information and a minor.- Parameters:
major
- Major version number.- Returns:
- The version.
-
version
Parses the string argument as a version. The string must be one of the following forms:major major.minor
- Parameters:
s
- The non-null
string to be parsed as a version.- Returns:
- The parsed version.
- Throws:
IllegalArgumentException
- If the string does not contain a parsable version.
-
getMajor
public int getMajor()Returns the major version number.- Returns:
- The major version number.
-
getMinor
public int getMinor()Returns the minor version number.- Returns:
- The minor version number.
-
equals
-
hashCode
public int hashCode() -
compareTo
- Specified by:
compareTo
in interfaceComparable<Version>
-
toString
-
isCompatibleWith
Returnsfalse
if:- the MAJOR version numbers are not the same.
-
the MAJOR version numbers are the same but
this
MINOR version number is LOWER thanthat
MINOR version number.
i.e. this version number - "2.0", that version number - "2.1" WILL NOT match, but this version number - "2.4", that version number - "2.1" WILL match. In other words, verifies ascending compatibility.
- Parameters:
that
- TheVersion
to match against.- Returns:
true
if both MAJOR version numbers are the same and ifthis
MINOR version number is HIGHER thanthat
MINOR version number.
-