Created
October 24, 2011 13:33
-
-
Save rkroll/1309033 to your computer and use it in GitHub Desktop.
DatabaseUpgrader.valueOf(string)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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