public final class Version extends Object implements IdentifiedDataSerializable, Comparable<Version>
VersionAware classes. The version is composed of two bytes,
denoting MAJOR.MINOR version. It is used to represent the Hazelcast cluster version and the serialization
version of VersionAware classes.| Modifier and Type | Field and Description |
|---|---|
static Version |
UNKNOWN
Version 0.0 is UNKNOWN constant
UNKNOWN is only equal to itself.
is(Less|Greater)Than method with an UNKNOWN operand returns false.
is(Less|Greater)OrEqual with an UNKNOWN operand returns false, unless both operands are UNKNOWN.
UNKNOWN.isUnknown(Less|Greater)(Than|OrEqual) returns true.
otherVersion.isUnknown(Less|Greater)(Than|OrEqual) with an UNKNOWN argument returns false.
|
static byte |
UNKNOWN_VERSION
Use 0 as major & minor values for UNKNOWN version
|
| Constructor and Description |
|---|
Version() |
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(Version o) |
boolean |
equals(Object o) |
int |
getClassId()
Returns type identifier for this class.
|
int |
getFactoryId()
Returns DataSerializableFactory factory ID for this class.
|
byte |
getMajor() |
byte |
getMinor() |
int |
hashCode() |
boolean |
isBetween(Version from,
Version to)
Checks if the version is between specified version (both ends inclusive)
|
boolean |
isEqualTo(Version version) |
boolean |
isGreaterOrEqual(Version version) |
boolean |
isGreaterThan(Version version) |
boolean |
isLessOrEqual(Version version) |
boolean |
isLessThan(Version version) |
boolean |
isUnknown() |
boolean |
isUnknownOrGreaterOrEqual(Version version) |
boolean |
isUnknownOrGreaterThan(Version version) |
boolean |
isUnknownOrLessOrEqual(Version version) |
boolean |
isUnknownOrLessThan(Version version) |
static Version |
of(int major,
int minor) |
static Version |
of(String version)
Parse the given string to a
Version. |
void |
readData(ObjectDataInput in)
Reads fields from the input stream
|
String |
toString() |
void |
writeData(ObjectDataOutput out)
Writes object fields to output stream
|
public static final byte UNKNOWN_VERSION
public static final Version UNKNOWN
is(Less|Greater)Than method with an UNKNOWN operand returns false.is(Less|Greater)OrEqual with an UNKNOWN operand returns false, unless both operands are UNKNOWN.UNKNOWN.isUnknown(Less|Greater)(Than|OrEqual) returns true.otherVersion.isUnknown(Less|Greater)(Than|OrEqual) with an UNKNOWN argument returns false.public byte getMajor()
public byte getMinor()
public void writeData(ObjectDataOutput out) throws IOException
DataSerializablewriteData in interface DataSerializableout - outputIOException - if an I/O error occurs. In particular,
an IOException may be thrown if the
output stream has been closed.public void readData(ObjectDataInput in) throws IOException
DataSerializablereadData in interface DataSerializablein - inputIOException - if an I/O error occurs. In particular,
an IOException may be thrown if the
input stream has been closed.public int compareTo(Version o)
compareTo in interface Comparable<Version>public int getFactoryId()
IdentifiedDataSerializablegetFactoryId in interface IdentifiedDataSerializablepublic int getClassId()
IdentifiedDataSerializablegetClassId in interface IdentifiedDataSerializablepublic static Version of(int major, int minor)
ClusterVersion with the given major and minorpublic static Version of(String version)
Version. This method may throw an IllegalArgumentExceptionversion - string to parse to Version.Version parsed from given argument.public boolean isEqualTo(Version version)
version - other version to compare totrue if this version equals versionpublic boolean isGreaterThan(Version version)
version - other version to compare totrue if this version is greater than versionpublic boolean isUnknownOrGreaterThan(Version version)
version - other version to compare totrue if this version is unknown or if this version is greater than versionpublic boolean isGreaterOrEqual(Version version)
version - other version to compare totrue if this version is greater than or equal to versionpublic boolean isUnknownOrGreaterOrEqual(Version version)
version - other version to compare totrue if this version is unknown or if this version is greater than or equal to versionpublic boolean isLessThan(Version version)
version - other version to compare totrue if this version is less than versionpublic boolean isUnknownOrLessThan(Version version)
version - other version to compare totrue if this version is unknown or if this version is less than versionpublic boolean isLessOrEqual(Version version)
version - other version to compare totrue if this version is less than or equal to versionpublic boolean isUnknownOrLessOrEqual(Version version)
version - other version to compare totrue if this version is unknown or if this version is less than or equal to versionpublic boolean isBetween(Version from, Version to)
from - the lower bound versionto - the upper bound versionpublic boolean isUnknown()
true if this version is equal to UNKNOWNCopyright © 2022 Hazelcast, Inc.. All rights reserved.