public final class Version extends Object implements Comparable<Version>
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Version that) |
boolean |
equals(Object o) |
int |
getMajor()
Returns the major version number.
|
int |
getMinor()
Returns the minor version number.
|
int |
hashCode() |
boolean |
isCompatibleWith(Version that)
Returns
false if:
the MAJOR version numbers are not the same. |
String |
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 |
version(String s)
Parses the string argument as a version.
|
public static Version version(int major, int minor)
major
- Major version number.minor
- Minor version number.public static Version version(int major)
major
- Major version number.public static Version version(String s)
major major.minor
s
- The non-null
string to be parsed as a version.IllegalArgumentException
- If the string does not contain a parsable version.public int getMajor()
public int getMinor()
public int compareTo(Version that)
compareTo
in interface Comparable<Version>
public boolean isCompatibleWith(Version that)
false
if:
this
MINOR
version number is LOWER than that
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.
that
- The Version
to match against.true
if both MAJOR version numbers are the same and if
this
MINOR version number is HIGHER than that
MINOR
version number.Copyright © 2010-2018, ForgeRock All Rights Reserved.