Skip to content

Instantly share code, notes, and snippets.

@rkroll
Created October 24, 2011 13:33
Show Gist options
  • Save rkroll/1309033 to your computer and use it in GitHub Desktop.
Save rkroll/1309033 to your computer and use it in GitHub Desktop.
DatabaseUpgrader.valueOf(string)
private static final String DOT = ".";
public static DatabaseVersion valueOf(String string) {
DatabaseVersion version;
if(StringUtils.contains(string, DOT)) {
String[] versionParts = StringUtils.split(string, DOT);
if(versionParts.length != 2) {
throw new IllegalArgumentException("Could not parse version number '" + string + "'");
}
version = valueOf(versionParts[0], versionParts[1]);
} else {
version = new DatabaseVersion(Integer.valueOf(string));
}
return version;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment