@Test public void testVersionParsing() { Version version = VersionUtils.parseVersion("4.0.5"); assertNotNull(version); assertEquals(4, version.getMajor()); assertEquals(0, version.getMinor()); assertEquals(5, version.getPatch()); assertNull(version.getLocal()); version = VersionUtils.parseVersion("4.0.5.3"); assertNotNull(version); assertEquals(4, version.getMajor()); assertEquals(0, version.getMinor()); assertEquals(5, version.getPatch()); assertEquals(Integer.valueOf(3), version.getLocal()); }
public static Version parseVersion(String versionString) { final Matcher versionMatcher = VERSION_PATTERN.matcher(versionString); if (!versionMatcher.matches()) { return null; } final int major = Integer.parseInt(versionMatcher.group(1)); final int minor = Integer.parseInt(versionMatcher.group(2)); final int patch = Integer.parseInt(versionMatcher.group(3)); final String local = versionMatcher.group(4); if (local != null) { return new SimpleVersion(major, minor, patch, Integer.valueOf(local)); } return new SimpleVersion(major, minor, patch); }
VersionUtils { public static Version parseVersion(String versionString) { final Matcher versionMatcher = VERSION_PATTERN.matcher(versionString); if (!versionMatcher.matches()) { return null; } final int major = Integer.parseInt(versionMatcher.group(1)); final int minor = Integer.parseInt(versionMatcher.group(2)); final int patch = Integer.parseInt(versionMatcher.group(3)); final String local = versionMatcher.group(4); if (local != null) { return new SimpleVersion(major, minor, patch, Integer.valueOf(local)); } return new SimpleVersion(major, minor, patch); } }
VersionUtils { public static Version parseVersion(String versionString) { final Matcher versionMatcher = VERSION_PATTERN.matcher(versionString); if (!versionMatcher.matches()) { return null; } final int major = Integer.parseInt(versionMatcher.group(1)); final int minor = Integer.parseInt(versionMatcher.group(2)); final int patch = Integer.parseInt(versionMatcher.group(3)); final String local = versionMatcher.group(4); if (local != null) { return new SimpleVersion(major, minor, patch, Integer.valueOf(local)); } return new SimpleVersion(major, minor, patch); }  }
VersionUtils { public static Version parseVersion(String versionString) { final Matcher versionMatcher = VERSION_PATTERN.matcher(versionString); if (!versionMatcher.matches()) { return null; } final int major = Integer.parseInt(versionMatcher.group(1)); final int minor = Integer.parseInt(versionMatcher.group(2)); final int patch = Integer.parseInt(versionMatcher.group(3)); final String local = versionMatcher.group(4); if (local != null) { return new SimpleVersion(major, minor, patch, Integer.valueOf(local)); } return new SimpleVersion(major, minor, patch); }  static Version parseVersion(String versionString); static Version.Field getMostSpecificMatchingField(Version v1, Version v2); static boolean canUpdate(Version from, Version to); }
VersionUtils { public static Version parseVersion(String versionString) { final Matcher versionMatcher = VERSION_PATTERN.matcher(versionString); if (!versionMatcher.matches()) { return null; } final int major = Integer.parseInt(versionMatcher.group(1)); final int minor = Integer.parseInt(versionMatcher.group(2)); final int patch = Integer.parseInt(versionMatcher.group(3)); final String local = versionMatcher.group(4); if (local != null) { return new SimpleVersion(major, minor, patch, Integer.valueOf(local)); } return new SimpleVersion(major, minor, patch); }  static Version parseVersion(String versionString); static Version.Field getMostSpecificMatchingField(Version v1, Version v2); static boolean canUpdate(Version from, Version to);  }