String (String pattern) { pattern = pattern.toLowerCase(); if (pattern.trim().isEmpty()) { return ""; } List<String> parts = StringUtil.split(pattern, "."); StringBuilder newPattern = new StringBuilder(); for (int i = 0; i < parts.size() - 1; i++) { String each = parts.get(i); newPattern.append(each.trim()); newPattern.append("*."); } String className = parts.get(parts.size() - 1); boolean exactSearch = className.endsWith(" "); newPattern.append(className.trim()); if (!exactSearch) newPattern.append("*"); return newPattern.toString(); }