1 16 package org.apache.commons.vfs; 17 18 import org.apache.commons.vfs.util.Messages; 19 20 26 public class FileFilterSelector extends FileDepthSelector 27 { 28 private FileFilter fileFilter; 29 30 public FileFilterSelector() 31 { 32 super(1, 1); 33 } 34 35 public FileFilterSelector(FileFilter fileFilter) 36 { 37 this(); 38 this.fileFilter = fileFilter; 39 } 40 41 44 public boolean includeFile(final FileSelectInfo fileInfo) 45 { 46 if (!super.includeFile(fileInfo)) 47 { 48 return false; 49 } 50 51 return accept(fileInfo); 52 } 53 54 public boolean accept(final FileSelectInfo fileInfo) 55 { 56 if (fileFilter != null) 57 { 58 return fileFilter.accept(fileInfo); 59 } 60 61 throw new IllegalArgumentException (Messages.getString("vfs.selectors/filefilter.missing.error")); 62 } 63 } 64 | Popular Tags |