org.apache.commons.finder.filters
Class RegexFilter

java.lang.Object
  extended by org.apache.commons.io.filefilter.AbstractFileFilter
      extended by org.apache.commons.finder.filters.RegexFilter
All Implemented Interfaces:
java.io.FileFilter, java.io.FilenameFilter, org.apache.commons.io.filefilter.IOFileFilter

public class RegexFilter
extends org.apache.commons.io.filefilter.AbstractFileFilter

IOFileFilter implementation that uses regular expression matching on the file path.

Since:
0.1
Version:
$Id: RegexFilter.java 437543 2006-08-28 05:47:51Z bayard $

Constructor Summary
RegexFilter(java.lang.String regex, boolean ignoreCase)
          Construct a new IOFileFilter specifying the regular expresion criteria.
 
Method Summary
 boolean accept(java.io.File file)
          Tests whether the File can matches a specified regular expression.
 java.lang.String getRegex()
          Returnt the regular expression.
 boolean isIgnoreCase()
          Indicates whether the case should be ignored.
 java.lang.String toString()
          Return a String representation of this class.
 
Methods inherited from class org.apache.commons.io.filefilter.AbstractFileFilter
accept
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RegexFilter

public RegexFilter(java.lang.String regex,
                   boolean ignoreCase)
Construct a new IOFileFilter specifying the regular expresion criteria.

Parameters:
regex - The regular expression.
ignoreCase - Whether the case should be ignored.
Method Detail

isIgnoreCase

public boolean isIgnoreCase()
Indicates whether the case should be ignored.

Returns:
true if the case should be ignored, otherwise false

getRegex

public java.lang.String getRegex()
Returnt the regular expression.

Returns:
The regular expression.

accept

public boolean accept(java.io.File file)
Tests whether the File can matches a specified regular expression.

Specified by:
accept in interface java.io.FileFilter
Specified by:
accept in interface org.apache.commons.io.filefilter.IOFileFilter
Overrides:
accept in class org.apache.commons.io.filefilter.AbstractFileFilter
Parameters:
file - The File to test.
Returns:
true if the File matches the regular expression, otherwise false.

toString

public java.lang.String toString()
Return a String representation of this class.

Overrides:
toString in class java.lang.Object
Returns:
a String representation of the class.


Copyright © 2001-2008 The Apache Software Foundation. All Rights Reserved.