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 TypeMethodDescriptionintbooleanintgetMajor()Returns the major version number.intgetMinor()Returns the minor version number.inthashCode()booleanisCompatibleWith(Version that) Returnsfalseif: the MAJOR version numbers are not the same.toString()static Versionversion(int major) Creates a new version using the provided version information and a minor.static Versionversion(int major, int minor) Creates a new version using the provided version information.static VersionParses 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-nullstring 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:
compareToin interfaceComparable<Version>
-
toString
-
isCompatibleWith
Returnsfalseif:- the MAJOR version numbers are not the same.
-
the MAJOR version numbers are the same but
thisMINOR version number is LOWER thanthatMINOR 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- TheVersionto match against.- Returns:
trueif both MAJOR version numbers are the same and ifthisMINOR version number is HIGHER thanthatMINOR version number.
-