public static ModuleVersion parse(String moduleVersion) {
    Matcher versionMatcher = validateModuleVersion(moduleVersion);
    ModuleVersion result = null;

    if (versionMatcher.pattern().pattern().equals(VERSION_WITH_HOTFIX_AND_BUILD_PATTERN)) {
      result = new ModuleVersion(Integer.parseInt(versionMatcher.group(1)), Integer.parseInt(versionMatcher.group(2)),
              Integer.parseInt(versionMatcher.group(3)), Integer.parseInt(versionMatcher.group(4)),
              Integer.parseInt(versionMatcher.group(5)), Integer.parseInt(versionMatcher.group(6)));

    } else {
      result = new ModuleVersion(Integer.parseInt(versionMatcher.group(1)), Integer.parseInt(versionMatcher.group(2)),
              Integer.parseInt(versionMatcher.group(3)), Integer.parseInt(versionMatcher.group(4)), 0,
              Integer.parseInt(versionMatcher.group(5)));

    }

    return result;
  }
Method which will parse module version
which user passed as parameter. Also
in this method version will be validated.
@param moduleVersion string
@return MpackVersion instance which contains parsed version
ambari-server/src/main/java/org/apache/ambari/server/utils/ModuleVersion.java