class NuxeoVersion {

    public static NuxeoVersion parse(String version) {
        Matcher matcher = NUXEO_VERSION_PATTERN.matcher(version);
        if (!matcher.matches()) {
            throw new NuxeoClientException(
                    "Input version=" + version + " doesn't represent a valid Nuxeo server version");
        }
        int majorVersion = Integer.parseInt(matcher.group(1));
        int minorVersion = Integer.parseInt(matcher.group(2));
        int buildVersion = -1;
        if (matcher.group(3) != null) {
            buildVersion = Integer.parseInt(matcher.group(3));
        }
        int hotfix = 0;
        if (matcher.group(4) != null) {
            hotfix = Integer.parseInt(matcher.group(4));
        }
        boolean snaphot = matcher.group(5) != null;
        return new NuxeoVersion(majorVersion, minorVersion, buildVersion, hotfix, snaphot);
    }

    protected  NuxeoVersion(int majorVersion, int minorVersion, int buildVersion, int hotfix, boolean snapshot);

}