private List<T> filterByKeywords(List<T> items) { List<T> result = new ArrayList<T>(); final Matcher[] matchers = getMatchers(); List<Property<T>> properties = getProperties(); for (T item : items) { ITEM: // find any match of any pattern over any property for (Property<T> property : properties) { if (property.isSearchable()) { Object value = property.getPropertyValue(item); if (value != null) { // brute force check for keywords for (Matcher matcher : matchers) { matcher.reset(String.valueOf(value)); if (matcher.matches()) { result.add(item); break ITEM; } } } } } } return result; }
private List<T> filterByKeywords(List<T> items) { List<T> result = new ArrayList<T>(); final Matcher[] matchers = getMatchers(); List<Property<T>> properties = getProperties(); for (T item : items) { ITEM: // find any match of any pattern over any property for (Property<T> property : properties) { if(property.isSearchable()) { Object value = property.getPropertyValue(item); if (value != null) { // brute force check for keywords for (Matcher matcher : matchers) { matcher.reset(String.valueOf(value)); if (matcher.matches()) { result.add(item); break ITEM; } } } } } } return result; }