private static Predicate<String> getMatcher(String part, boolean exactMatchIfEndsWithSpace) {
if (StringUtils.isBlank(part)) {
return Predicates.alwaysTrue();
}
if (part.contains("*")) {
return new StringMatcherPredicate(new WildcardStringMatcher(false), part);
}
if (part.endsWith(" ") && exactMatchIfEndsWithSpace) {
return new StringMatcherPredicate(StringMatcher.EQUALS_IGNORE_CASE , part.trim());
}
return new StringMatcherPredicate(StringMatcher.STARTS_WITH_IGNORE_CASE , part);
}