Class VersionWithBuild


  • public final class VersionWithBuild
    extends Object
    Version with build utility methods.
    Restriction:
    This class is not intended to be sub-classed by clients.
    Restriction:
    This class is not intended to be instantiated by clients.
    • Field Detail

      • PATTERN

        public static final Pattern PATTERN
        Version-with-build mask. Value pattern is digit+.digit+.digit+.digit+.
    • Method Detail

      • parseVersion

        public static Version parseVersion​(String versionWithBuild)
        Parse valid instance of Version from the given version with build string.

        Version with build must match digit+.digit+.digit+.digit+ pattern, IllegalArgumentException will be thrown otherwise.

        Parameters:
        versionWithBuild - version with build, cannot be null
        Returns:
        version, never null
        Throws:
        IllegalArgumentException - if given version with build is null or have incorrect format
      • parseBuild

        public static int parseBuild​(String versionWithBuild)
        Parse build number from the given version with build string.

        Version with build must match digit+.digit+.digit+.digit+ pattern, IllegalArgumentException will be thrown otherwise.

        Parameters:
        versionWithBuild - version with build, cannot be null
        Returns:
        build number
        Throws:
        IllegalArgumentException - if given version with build is null or have incorrect format
      • isValid

        public static boolean isValid​(String versionWithBuild)
        Returns, whether the given string represents version with build.
        Parameters:
        versionWithBuild - version with build, cannot be null
        Returns:
        whether the given string represents version with build
      • toVersionWithBuild

        public static String toVersionWithBuild​(Version version,
                                                int build)
        Returns string-represented version with build. Version with build will be formatted as:
         digit+.digit+.digit+.digit+
        Parameters:
        version - the version, cannot be null
        version - the build
        Returns:
        string-represented version with build, never null