001 package railo.commons.io.res.filter; 002 003 import railo.commons.io.res.Resource; 004 005 006 /** 007 * A FileFilter providing conditional OR logic across a list of file filters. 008 * This filter returns true if any filters in the list return true. Otherwise, it returns false. 009 * Checking of the file filter list stops when the first filter returns true. 010 */ 011 public final class AndResourceFilter implements ResourceFilter { 012 013 private final ResourceFilter[] filters; 014 015 /** 016 * @param filters 017 */ 018 public AndResourceFilter(ResourceFilter[] filters) { 019 this.filters=filters; 020 } 021 022 /** 023 * 024 * @see railo.commons.io.res.filter.ResourceFilter#accept(railo.commons.io.res.Resource) 025 */ 026 public boolean accept(Resource f) { 027 for(int i=0;i<filters.length;i++) { 028 if(!filters[i].accept(f)) return false; 029 } 030 return true; 031 } 032 }