001 package railo.commons.io.res.util; 002 003 import railo.commons.io.SystemUtil; 004 import railo.commons.io.res.Resource; 005 006 007 public class WildcardPatternFilter implements ResourceAndResourceNameFilter { 008 009 010 private final WildcardPattern matcher; 011 012 013 public WildcardPatternFilter( String patt, boolean ignoreCase ) { 014 015 matcher = new WildcardPattern( patt, !ignoreCase ); 016 } 017 018 019 public WildcardPatternFilter( String pattern ) { 020 021 this( pattern, SystemUtil.isWindows() ); 022 } 023 024 025 @Override 026 public boolean accept( Resource res ) { 027 028 return matcher.isMatch( res.getName() ); 029 } 030 031 032 @Override 033 public boolean accept( Resource res, String name ) { 034 035 return matcher.isMatch( name ); 036 } 037 038 039 public boolean accept( String name ) { 040 041 return matcher.isMatch( name ); 042 } 043 044 045 @Override 046 public String toString() { 047 048 return matcher.toString(); 049 } 050 051 }