Class VersionInfo

java.lang.Object
com.ibm.icu.util.VersionInfo
All Implemented Interfaces:
Comparable<VersionInfo>

public final class VersionInfo extends Object implements Comparable<VersionInfo>
Class to store version numbers of the form major.minor.milli.micro.
  • Field Details

    • UNICODE_1_0

      public static final VersionInfo UNICODE_1_0
      Unicode 1.0 version
    • UNICODE_1_0_1

      public static final VersionInfo UNICODE_1_0_1
      Unicode 1.0.1 version
    • UNICODE_1_1_0

      public static final VersionInfo UNICODE_1_1_0
      Unicode 1.1.0 version
    • UNICODE_1_1_5

      public static final VersionInfo UNICODE_1_1_5
      Unicode 1.1.5 version
    • UNICODE_2_0

      public static final VersionInfo UNICODE_2_0
      Unicode 2.0 version
    • UNICODE_2_1_2

      public static final VersionInfo UNICODE_2_1_2
      Unicode 2.1.2 version
    • UNICODE_2_1_5

      public static final VersionInfo UNICODE_2_1_5
      Unicode 2.1.5 version
    • UNICODE_2_1_8

      public static final VersionInfo UNICODE_2_1_8
      Unicode 2.1.8 version
    • UNICODE_2_1_9

      public static final VersionInfo UNICODE_2_1_9
      Unicode 2.1.9 version
    • UNICODE_3_0

      public static final VersionInfo UNICODE_3_0
      Unicode 3.0 version
    • UNICODE_3_0_1

      public static final VersionInfo UNICODE_3_0_1
      Unicode 3.0.1 version
    • UNICODE_3_1_0

      public static final VersionInfo UNICODE_3_1_0
      Unicode 3.1.0 version
    • UNICODE_3_1_1

      public static final VersionInfo UNICODE_3_1_1
      Unicode 3.1.1 version
    • UNICODE_3_2

      public static final VersionInfo UNICODE_3_2
      Unicode 3.2 version
    • UNICODE_4_0

      public static final VersionInfo UNICODE_4_0
      Unicode 4.0 version
    • UNICODE_4_0_1

      public static final VersionInfo UNICODE_4_0_1
      Unicode 4.0.1 version
    • UNICODE_4_1

      public static final VersionInfo UNICODE_4_1
      Unicode 4.1 version
    • UNICODE_5_0

      public static final VersionInfo UNICODE_5_0
      Unicode 5.0 version
    • UNICODE_5_1

      public static final VersionInfo UNICODE_5_1
      Unicode 5.1 version
    • UNICODE_5_2

      public static final VersionInfo UNICODE_5_2
      Unicode 5.2 version
    • UNICODE_6_0

      public static final VersionInfo UNICODE_6_0
      Unicode 6.0 version
    • UNICODE_6_1

      public static final VersionInfo UNICODE_6_1
      Unicode 6.1 version
    • UNICODE_6_2

      public static final VersionInfo UNICODE_6_2
      Unicode 6.2 version
    • UNICODE_6_3

      public static final VersionInfo UNICODE_6_3
      Unicode 6.3 version
    • UNICODE_7_0

      public static final VersionInfo UNICODE_7_0
      Unicode 7.0 version
    • UNICODE_8_0

      public static final VersionInfo UNICODE_8_0
      Unicode 8.0 version
    • UNICODE_9_0

      public static final VersionInfo UNICODE_9_0
      Unicode 9.0 version
    • UNICODE_10_0

      public static final VersionInfo UNICODE_10_0
      Unicode 10.0 version
    • UNICODE_11_0

      public static final VersionInfo UNICODE_11_0
      Unicode 11.0 version
    • UNICODE_12_0

      public static final VersionInfo UNICODE_12_0
      Unicode 12.0 version
    • UNICODE_12_1

      public static final VersionInfo UNICODE_12_1
      Unicode 12.1 version
    • UNICODE_13_0

      public static final VersionInfo UNICODE_13_0
      Unicode 13.0 version
    • UNICODE_14_0

      public static final VersionInfo UNICODE_14_0
      Unicode 14.0 version
    • UNICODE_15_0

      public static final VersionInfo UNICODE_15_0
      Unicode 15.0 version
    • UNICODE_15_1

      public static final VersionInfo UNICODE_15_1
      Unicode 15.1 version
    • UNICODE_16_0

      public static final VersionInfo UNICODE_16_0
      Unicode 16.0 version
    • ICU_VERSION

      public static final VersionInfo ICU_VERSION
      ICU4J current release version
    • ICU_DATA_VERSION_PATH

      @Deprecated public static final String ICU_DATA_VERSION_PATH
      Deprecated.
      This API is ICU internal only.
      Data version string for ICU's data file. Not used when loading from resources packaged in the .jar. Used for appending to data path (e.g. icudt43b)
      See Also:
    • ICU_DATA_VERSION

      @Deprecated public static final VersionInfo ICU_DATA_VERSION
      Deprecated.
      This API is ICU internal only.
      Data version in ICU4J.
    • UCOL_RUNTIME_VERSION

      public static final VersionInfo UCOL_RUNTIME_VERSION
      Collation runtime version (sort key generator, string comparisons). If the version is different, sort keys for the same string could be different. This value may change in subsequent releases of ICU.
    • UCOL_BUILDER_VERSION

      public static final VersionInfo UCOL_BUILDER_VERSION
      Collation builder code version. When this is different, the same tailoring might result in assigning different collation elements to code points. This value may change in subsequent releases of ICU.
    • UCOL_TAILORINGS_VERSION

      @Deprecated public static final VersionInfo UCOL_TAILORINGS_VERSION
      Deprecated.
      ICU 54
      Constant version 1. This was intended to be the version of collation tailorings, but instead the tailoring data carries a version number.
    • UNICODE_VERSION

      private static final VersionInfo UNICODE_VERSION
      Unicode data version used by the current release. Defined here privately for printing by the main() method in this class. Should be the same as UCharacter.getUnicodeVersion() which gets the version number from a data file. We do not want VersionInfo to have an import dependency on UCharacter.
    • m_version_

      private int m_version_
      Version number stored as a byte for each of the major, minor, milli and micro numbers in the 32 bit int. Most significant for the major and the least significant contains the micro numbers.
    • MAP_

      private static final ConcurrentHashMap<Integer,VersionInfo> MAP_
      Map of singletons
    • LAST_BYTE_MASK_

      private static final int LAST_BYTE_MASK_
      Last byte mask
      See Also:
    • INVALID_VERSION_NUMBER_

      private static final String INVALID_VERSION_NUMBER_
      Error statement string
      See Also:
    • TZDATA_VERSION

      private static volatile String TZDATA_VERSION
  • Constructor Details

    • VersionInfo

      private VersionInfo(int compactversion)
      Constructor with int
      Parameters:
      compactversion - a 32 bit int with each byte representing a number
  • Method Details

    • getInstance

      public static VersionInfo getInstance(String version)
      Returns an instance of VersionInfo with the argument version.
      Parameters:
      version - version String in the format of "major.minor.milli.micro" or "major.minor.milli" or "major.minor" or "major", where major, minor, milli, micro are non-negative numbers <= 255. If the trailing version numbers are not specified they are taken as 0s. E.g. Version "3.1" is equivalent to "3.1.0.0".
      Returns:
      an instance of VersionInfo with the argument version.
      Throws:
      IllegalArgumentException - when the argument version is not in the right format
    • getInstance

      public static VersionInfo getInstance(int major, int minor, int milli, int micro)
      Returns an instance of VersionInfo with the argument version.
      Parameters:
      major - major version, non-negative number <= 255.
      minor - minor version, non-negative number <= 255.
      milli - milli version, non-negative number <= 255.
      micro - micro version, non-negative number <= 255.
      Throws:
      IllegalArgumentException - when either arguments are negative or > 255
    • getInstance

      public static VersionInfo getInstance(int major, int minor, int milli)
      Returns an instance of VersionInfo with the argument version. Equivalent to getInstance(major, minor, milli, 0).
      Parameters:
      major - major version, non-negative number <= 255.
      minor - minor version, non-negative number <= 255.
      milli - milli version, non-negative number <= 255.
      Throws:
      IllegalArgumentException - when either arguments are negative or > 255
    • getInstance

      public static VersionInfo getInstance(int major, int minor)
      Returns an instance of VersionInfo with the argument version. Equivalent to getInstance(major, minor, 0, 0).
      Parameters:
      major - major version, non-negative number <= 255.
      minor - minor version, non-negative number <= 255.
      Throws:
      IllegalArgumentException - when either arguments are negative or > 255
    • getInstance

      public static VersionInfo getInstance(int major)
      Returns an instance of VersionInfo with the argument version. Equivalent to getInstance(major, 0, 0, 0).
      Parameters:
      major - major version, non-negative number <= 255.
      Throws:
      IllegalArgumentException - when either arguments are negative or > 255
    • toString

      public String toString()
      Returns the String representative of VersionInfo in the format of "major.minor.milli.micro"
      Overrides:
      toString in class Object
      Returns:
      String representative of VersionInfo
    • getMajor

      public int getMajor()
      Returns the major version number
      Returns:
      the major version number
    • getMinor

      public int getMinor()
      Returns the minor version number
      Returns:
      the minor version number
    • getMilli

      public int getMilli()
      Returns the milli version number
      Returns:
      the milli version number
    • getMicro

      public int getMicro()
      Returns the micro version number
      Returns:
      the micro version number
    • equals

      public boolean equals(Object other)
      Checks if this version information is equals to the argument version
      Overrides:
      equals in class Object
      Parameters:
      other - object to be compared
      Returns:
      true if other is equals to this object's version information, false otherwise
    • hashCode

      public int hashCode()
      Returns the hash code value for this set.
      Overrides:
      hashCode in class Object
      Returns:
      the hash code value for this set.
      See Also:
    • compareTo

      public int compareTo(VersionInfo other)
      Compares other with this VersionInfo.
      Specified by:
      compareTo in interface Comparable<VersionInfo>
      Parameters:
      other - VersionInfo to be compared
      Returns:
      0 if the argument is a VersionInfo object that has version information equals to this object. Less than 0 if the argument is a VersionInfo object that has version information greater than this object. Greater than 0 if the argument is a VersionInfo object that has version information less than this object.
    • getInt

      private static int getInt(int major, int minor, int milli, int micro)
      Gets the int from the version numbers
      Parameters:
      major - non-negative version number
      minor - non-negative version number
      milli - non-negative version number
      micro - non-negative version number
    • main

      public static void main(String[] args)
      Main method prints out ICU version information
      Parameters:
      args - arguments (currently not used)
    • getVersionString

      @Deprecated public String getVersionString(int minDigits, int maxDigits)
      Deprecated.
      This API is ICU internal only. (For use in CLDR, etc.)
      Generate version string separated by dots with the specified digit width. Version digit 0 after minDigits will be trimmed off.
      Parameters:
      minDigits - Minimum number of version digits
      maxDigits - Maximum number of version digits
      Returns:
      A tailored version string
    • getTZDataVersion

      static String getTZDataVersion()