~ubuntu-branches/ubuntu/quantal/commons-io/quantal

« back to all changes in this revision

Viewing changes to src/java/org/apache/commons/io/filefilter/DelegateFileFilter.java

  • Committer: Bazaar Package Importer
  • Author(s): Varun Hiremath
  • Date: 2008-02-21 13:26:43 UTC
  • mfrom: (1.1.3 upstream) (3.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080221132643-p4c8f8lhb9rnqnlo
Tags: 1.4-1
* New upstream release
* Bump Standards-Version to 3.7.3
* Bump up debhelper compat to 6
* Replace XS-Vcs headers with Vcs
* debian/patches:
  - remove 01_no_ext_links.dpatch - not required
  - remove 02_no_mkdir_in_homedir.dpatch - not required
* Remove dpatch from Build-Depends
* Update debian/rules and debian/libcommons-io-java-doc.install
  with new target dirs
* debian/copyright: add copyright notice

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
import java.io.File;
20
20
import java.io.FileFilter;
21
21
import java.io.FilenameFilter;
 
22
import java.io.Serializable;
22
23
 
23
24
/**
24
25
 * This class turns a Java FileFilter or FilenameFilter into an IO FileFilter.
25
26
 * 
26
27
 * @since Commons IO 1.0
27
 
 * @version $Revision: 471628 $ $Date: 2006-11-06 05:06:45 +0100 (Mo, 06 Nov 2006) $
 
28
 * @version $Revision: 591058 $ $Date: 2007-11-01 15:47:05 +0000 (Thu, 01 Nov 2007) $
28
29
 * 
29
30
 * @author Stephen Colebourne
30
31
 */
31
 
public class DelegateFileFilter extends AbstractFileFilter {
 
32
public class DelegateFileFilter extends AbstractFileFilter implements Serializable {
32
33
 
33
34
    /** The Filename filter */
34
 
    private FilenameFilter filenameFilter;
 
35
    private final FilenameFilter filenameFilter;
35
36
    /** The File filter */
36
 
    private FileFilter fileFilter;
 
37
    private final FileFilter fileFilter;
37
38
 
38
39
    /**
39
40
     * Constructs a delegate file filter around an existing FilenameFilter.
45
46
            throw new IllegalArgumentException("The FilenameFilter must not be null");
46
47
        }
47
48
        this.filenameFilter = filter;
 
49
        this.fileFilter = null;
48
50
    }
49
51
 
50
52
    /**
57
59
            throw new IllegalArgumentException("The FileFilter must not be null");
58
60
        }
59
61
        this.fileFilter = filter;
 
62
        this.filenameFilter = null;
60
63
    }
61
64
 
62
65
    /**
87
90
            return super.accept(dir, name);
88
91
        }
89
92
    }
 
93
 
 
94
    /**
 
95
     * Provide a String representaion of this file filter.
 
96
     *
 
97
     * @return a String representaion
 
98
     */
 
99
    public String toString() {
 
100
        String delegate = (fileFilter != null ? fileFilter.toString() : filenameFilter.toString()); 
 
101
        return super.toString() + "(" + delegate + ")";
 
102
    }
90
103
    
91
104
}