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.
Versionobjects are immutable.- Restriction:
- This class is not intended to be subclassed by clients.
-
-
Field Summary
Fields Modifier and Type Field Description static VersionEMPTY_VERSIONThe empty version "0.0.0".static VersionLATESTstatic VersionV8_3_10static VersionV8_3_11static VersionV8_3_12static VersionV8_3_13static VersionV8_3_14static VersionV8_3_15static VersionV8_3_16static VersionV8_3_17static VersionV8_3_18static VersionV8_3_19static VersionV8_3_20static VersionV8_3_21static VersionV8_3_22static VersionV8_3_6static VersionV8_3_7static VersionV8_3_8static VersionV8_3_9
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(Version other)Compares thisVersionobject to anotherVersion.static Versioncreate(String version)Parses a version identifier from the specified string.booleanequals(Object obj)intgetMajor()Returns the major component of this version identifier.intgetMicro()Returns the micro component of this version identifier.intgetMinor()Returns the minor component of this version identifier.inthashCode()booleanisGreaterThan(Version that)Compares that thisVersionobject is greater than specifiedVersionobjectbooleanisInRange(String versionRange)Checks if given version is in specified version range and false otherwise.booleanisLessThan(Version that)Compares that thisVersionobject is less than specifiedVersionobjectstatic VersionparseCompatibilityMode(CompatibilityMode mode)ParseCompatibilityModeto platfromVersion.static VersionparseVersion(String version)Parses a version identifier from the specified string.StringtoString()
-
-
-
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
-
V8_3_22
public static final Version V8_3_22
-
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- Ifversionis improperly formatted.
-
-
Method Detail
-
parseCompatibilityMode
public static Version parseCompatibilityMode(CompatibilityMode mode)
ParseCompatibilityModeto platfromVersion. It will be equals to compatibility mode version.- Parameters:
mode- the compatibility mode to parseVersionfrom, 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
Versionobject representing the version identifier. Ifversionisnullor the empty string thenEMPTY_VERSIONwill be returned. - Throws:
IllegalArgumentException- Ifversionis 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
Versionobject representing the version identifier. Ifversionisnullor the empty string thennullwill be returned.
ifversionhas illegal formatnullwill 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 thisVersionobject is greater than specifiedVersionobject- Parameters:
that- TheVersionobject to be compared, notnull- Returns:
trueif this version is greater than the specifiedVersionobject,falsein otherwise
-
isLessThan
public boolean isLessThan(Version that)
Compares that thisVersionobject is less than specifiedVersionobject- Parameters:
that- TheVersionobject to be compared, notnull- Returns:
trueif this version is less than the specifiedVersionobject,falsein 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 thisVersionobject 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:
compareToin interfaceComparable<Version>- Parameters:
other- TheVersionobject 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
Versionobject. - Throws:
ClassCastException- If the specified object is not aVersionobject.
-
-