View Javadoc

1   package com.atlassian.core.util.filter;
2   
3   import java.util.List;
4   import java.util.ArrayList;
5   
6   /**
7    * Composite Filter that applies a series of filters in turn.
8    *
9    * By default, the composite filter lets all objects through, so 
10   * a composite filter with no filters added,
11   *
12   * @deprecated use the utility methods on Guava's {@code Predicates} to combine {@code Predicate}
13   */
14  @Deprecated
15  public class FilterChain<T> implements Filter<T>
16  {
17      private final List<Filter<T>> filters = new ArrayList<Filter<T>>();
18  
19      public FilterChain() {}
20  
21      public void addFilter(Filter<T> filter)
22      {
23          filters.add(filter);
24      }
25  
26      public boolean isIncluded(T o)
27      {
28          for (Filter<T> filter : filters)
29          {
30              if (!filter.isIncluded(o))
31                  return false;
32          }
33  
34          return true;
35      }
36  }