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
|
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 |
getFactoryId()
Returns DataSerializableFactory factory ID for this class.
|
int |
getId()
Returns type identifier 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
DataSerializable
writeData
in interface DataSerializable
out
- 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
DataSerializable
readData
in interface DataSerializable
in
- 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()
IdentifiedDataSerializable
getFactoryId
in interface IdentifiedDataSerializable
public int getId()
IdentifiedDataSerializable
getId
in interface IdentifiedDataSerializable
public 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 IllegalArgumentException
version
- 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 version
public boolean isGreaterThan(Version version)
version
- other version to compare totrue
if this version is greater than version
public boolean isUnknownOrGreaterThan(Version version)
version
- other version to compare totrue
if this version is unknown or if this version is greater than version
public boolean isGreaterOrEqual(Version version)
version
- other version to compare totrue
if this version is greater than or equal to version
public 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 version
public boolean isLessThan(Version version)
version
- other version to compare totrue
if this version is less than version
public boolean isUnknownOrLessThan(Version version)
version
- other version to compare totrue
if this version is unknown or if this version is less than version
public boolean isLessOrEqual(Version version)
version
- other version to compare totrue
if this version is less than or equal to version
public 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 version
public boolean isBetween(Version from, Version to)
from
- to
- public boolean isUnknown()
true
if this version is equal to UNKNOWN
Copyright © 2018 Hazelcast, Inc.. All rights reserved.