Class Version


  • public final class Version
    extends Object
    • Constructor Detail

      • Version

        public Version()
    • Method Detail

      • getVersionStringComparatorInstance

        public static Comparator<String> getVersionStringComparatorInstance()
        Returns a comparator that can be used to compare version strings like 1.5.1.
        Returns:
        a comparator to compare version strings
      • getParsedVersionStringComparatorInstance

        public static Comparator<int[]> getParsedVersionStringComparatorInstance()
        Gets a comparator that can be used to compare parsed version strings like 1.5.1 (being [1, 5, 1]).
        Returns:
        A comparator to compare parsed version strings.
      • getVersionInformation

        public static Pair<String,​Boolean> getVersionInformation​(Class<?> cls)
        Gets the version information from the version file that is part of the class bundle containing the designated class. The first element will be the version string (version, build, build date or not available), the second element indicates whether this is a pre-release and not a final one.
        Parameters:
        cls - The class relative to which to load the version file.
        Returns:
        The version string (version, build and build date or not available) and whether the version is a pre-release.
      • getParsedVersionInformation

        public static SerialisablePair<String,​String> getParsedVersionInformation​(Class<?> cls)
        Gets the version information from the version file that is part of the class bundle containing the designated class and parses the information. The elements will be the version and the build date or <unknown> if not available.
        Parameters:
        cls - The class relative to which to load the version file.
        Returns:
        The version and the build date or <unknown> if not available.
        See Also:
        getVersionInformation(Class)
      • getParsedVersion

        public static int[] getParsedVersion​(String version)
        Parses a version string consisting of digits separated by . into an integer array whereas each array element is the number represented between the .. If one of the parts between the . is no valid PATTERN, it will be ignored.
        Parameters:
        version - The version string which to parse.
        Returns:
        The numbers parsed from the designated version string containing digits separated by . or null if the designated string contains no . and contains non-digit characters.
      • getReleaseInformation

        public static String[] getReleaseInformation​(String release)
        Parses the release information from the designated string. This is the string that is printed to console by the applications.
        Parameters:
        release - The release information as printed on console.
        Returns:
        The version, the prebuild-string (may be null) and the build date parsed from the release or 3 null elements if the release information cannot be parsed.