Class Version
- java.lang.Object
-
- com._1c.g5.v8.dt.platform.version.Version
-
- All Implemented Interfaces:
Comparable<Version>
public class Version extends Object implements Comparable<Version>
Version identifier for 1C:Enterprise runtime.Version consists of three components
- Major version. A non-negative integer.
- Minor version. A non-negative integer.
- Micro version. A non-negative integer.
Version
objects are immutable.- Restriction:
- This class is not intended to be subclassed by clients.
-
-
Field Summary
Fields Modifier and Type Field Description static Version
EMPTY_VERSION
The empty version "0.0.0".static Version
LATEST
static Version
V8_3_10
static Version
V8_3_11
static Version
V8_3_12
static Version
V8_3_13
static Version
V8_3_14
static Version
V8_3_15
static Version
V8_3_16
static Version
V8_3_17
static Version
V8_3_18
static Version
V8_3_19
static Version
V8_3_20
static Version
V8_3_21
static Version
V8_3_6
static Version
V8_3_7
static Version
V8_3_8
static Version
V8_3_9
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(Version other)
Compares thisVersion
object to anotherVersion
.static Version
create(String version)
Parses a version identifier from the specified string.boolean
equals(Object obj)
int
getMajor()
Returns the major component of this version identifier.int
getMicro()
Returns the micro component of this version identifier.int
getMinor()
Returns the minor component of this version identifier.int
hashCode()
boolean
isGreaterThan(Version that)
Compares that thisVersion
object is greater than specifiedVersion
objectboolean
isInRange(String versionRange)
Checks if given version is in specified version range and false otherwise.boolean
isLessThan(Version that)
Compares that thisVersion
object is less than specifiedVersion
objectstatic Version
parseCompatibilityMode(CompatibilityMode mode)
ParseCompatibilityMode
to platfromVersion
.static Version
parseVersion(String version)
Parses a version identifier from the specified string.String
toString()
-
-
-
Field Detail
-
V8_3_6
public static final Version V8_3_6
-
V8_3_7
public static final Version V8_3_7
-
V8_3_8
public static final Version V8_3_8
-
V8_3_9
public static final Version V8_3_9
-
V8_3_10
public static final Version V8_3_10
-
V8_3_11
public static final Version V8_3_11
-
V8_3_12
public static final Version V8_3_12
-
V8_3_13
public static final Version V8_3_13
-
V8_3_14
public static final Version V8_3_14
-
V8_3_15
public static final Version V8_3_15
-
V8_3_16
public static final Version V8_3_16
-
V8_3_17
public static final Version V8_3_17
-
V8_3_18
public static final Version V8_3_18
-
V8_3_19
public static final Version V8_3_19
-
V8_3_20
public static final Version V8_3_20
-
V8_3_21
public static final Version V8_3_21
-
LATEST
public static final Version LATEST
-
EMPTY_VERSION
public static final Version EMPTY_VERSION
The empty version "0.0.0".
-
-
Constructor Detail
-
Version
public Version(int major, int minor, int micro)
Creates a version identifier from the specified numerical components.- Parameters:
major
- Major component of the version identifier, not negative.minor
- Minor component of the version identifier, not negative.micro
- Micro component of the version identifier, not negative.- Throws:
IllegalArgumentException
- If the numerical components are negative.
-
Version
public Version(String version)
Creates a version identifier from the specified string.Version string grammar:
version ::= major('.'minor('.'micro)?)? major ::= digit+ minor ::= digit+ micro ::= digit+ digit ::= [0..9]
- Parameters:
version
- String representation of the version identifier. There must be no whitespace in the argument.- Throws:
IllegalArgumentException
- Ifversion
is improperly formatted.
-
-
Method Detail
-
parseCompatibilityMode
public static Version parseCompatibilityMode(CompatibilityMode mode)
ParseCompatibilityMode
to platfromVersion
. It will be equals to compatibility mode version.- Parameters:
mode
- the compatibility mode to parseVersion
from, cannot benull
- Returns:
- parsed
Version
, nevernull
-
parseVersion
public static Version parseVersion(String version)
Parses a version identifier from the specified string.See
Version(String)
for the format of the version string.- Parameters:
version
- String representation of the version identifier. Leading and trailing whitespace will be ignored.- Returns:
- A
Version
object representing the version identifier. Ifversion
isnull
or the empty string thenEMPTY_VERSION
will be returned. - Throws:
IllegalArgumentException
- Ifversion
is improperly formatted.
-
create
public static Version create(String version)
Parses a version identifier from the specified string.Version string grammar:
version ::= 'major.minor.micro' major ::= digit+ minor ::= digit+ micro ::= digit+ digit ::= [0..9]
See
Version(String)
for the format of the version string.- Parameters:
version
- String representation of the version identifier. Leading and trailing whitespace will be ignored.- Returns:
- A
Version
object representing the version identifier. Ifversion
isnull
or the empty string thennull
will be returned.
ifversion
has illegal formatnull
will be returned.
-
isInRange
public boolean isInRange(String versionRange)
Checks if given version is in specified version range and false otherwise.Version range string grammar
range ::= ('['|'(')version(, version)?(']'|')') version ::= major('.'minor('.'micro)?)? major ::= digit+ minor ::= digit+ micro ::= digit+ digit ::= [0..9]
Example usage:
Version version = ... if (version.isInRange("[8.3.2, 8.3.5)")) // do something
- Parameters:
versionRange
- the version range (notnull
).- Returns:
- true when given version is in specified version range and false otherwise.
- Throws:
IllegalArgumentException
- If versionRange is improperly formatted.
-
isGreaterThan
public boolean isGreaterThan(Version that)
Compares that thisVersion
object is greater than specifiedVersion
object- Parameters:
that
- TheVersion
object to be compared, notnull
- Returns:
true
if this version is greater than the specifiedVersion
object,false
in otherwise
-
isLessThan
public boolean isLessThan(Version that)
Compares that thisVersion
object is less than specifiedVersion
object- Parameters:
that
- TheVersion
object to be compared, notnull
- Returns:
true
if this version is less than the specifiedVersion
object,false
in otherwise
-
getMajor
public int getMajor()
Returns the major component of this version identifier.- Returns:
- The major component.
-
getMinor
public int getMinor()
Returns the minor component of this version identifier.- Returns:
- The minor component.
-
getMicro
public int getMicro()
Returns the micro component of this version identifier.- Returns:
- The micro component.
-
compareTo
public int compareTo(Version other)
Compares thisVersion
object to anotherVersion
.A version is considered to be less than another version if its major component is less than the other version's major component, or the major components are equal and its minor component is less than the other version's minor component, or the major and minor components are equal and its micro component is less than the other version's micro component.
A version is considered to be equal to another version if the major, minor and micro components are equal.
- Specified by:
compareTo
in interfaceComparable<Version>
- Parameters:
other
- TheVersion
object to be compared, notnull
- Returns:
- A negative integer, zero, or a positive integer if this version
is less than, equal to, or greater than the specified
Version
object. - Throws:
ClassCastException
- If the specified object is not aVersion
object.
-
-