VersionTokenType (String str) { if (str == null) { return _WS; } str = str.trim(); if (str.length() == 0) { return _WS; } for (VersionTokenType token : VALUES) { final String name = token.name(); if (name.charAt(0) != '_' && name.equalsIgnoreCase(str)) { return token; } } if (ZERO_PATTERN.matcher(str).matches()) { return _WS; } if (DIGITS_PATTERN.matcher(str).matches()) { return _DIGITS; } return _WORD; }