6386 |
15 Sep 21 |
nicklas |
1 |
package net.sf.basedb.reggie.plugins.release; |
6386 |
15 Sep 21 |
nicklas |
2 |
|
6386 |
15 Sep 21 |
nicklas |
3 |
import java.util.regex.Pattern; |
6386 |
15 Sep 21 |
nicklas |
4 |
|
6386 |
15 Sep 21 |
nicklas |
5 |
import net.sf.basedb.core.File; |
6386 |
15 Sep 21 |
nicklas |
6 |
import net.sf.basedb.util.filter.Filter; |
6386 |
15 Sep 21 |
nicklas |
7 |
|
6386 |
15 Sep 21 |
nicklas |
8 |
/** |
6386 |
15 Sep 21 |
nicklas |
Filter implementation for filtering files based on a regular expression. |
6386 |
15 Sep 21 |
nicklas |
10 |
|
6386 |
15 Sep 21 |
nicklas |
@author nicklas |
6389 |
15 Sep 21 |
nicklas |
@since 4.32 |
6386 |
15 Sep 21 |
nicklas |
13 |
*/ |
6386 |
15 Sep 21 |
nicklas |
14 |
public class RegexpFileFilter |
6386 |
15 Sep 21 |
nicklas |
15 |
implements Filter<File> |
6386 |
15 Sep 21 |
nicklas |
16 |
{ |
6386 |
15 Sep 21 |
nicklas |
17 |
|
6386 |
15 Sep 21 |
nicklas |
18 |
private final Pattern p; |
6386 |
15 Sep 21 |
nicklas |
19 |
|
6386 |
15 Sep 21 |
nicklas |
20 |
/** |
6386 |
15 Sep 21 |
nicklas |
Create a new file filter. |
6386 |
15 Sep 21 |
nicklas |
22 |
*/ |
6386 |
15 Sep 21 |
nicklas |
23 |
public RegexpFileFilter(Pattern p) |
6386 |
15 Sep 21 |
nicklas |
24 |
{ |
6386 |
15 Sep 21 |
nicklas |
25 |
this.p = p; |
6386 |
15 Sep 21 |
nicklas |
26 |
} |
6386 |
15 Sep 21 |
nicklas |
27 |
|
6386 |
15 Sep 21 |
nicklas |
28 |
@Override |
6386 |
15 Sep 21 |
nicklas |
29 |
public boolean evaluate(File f) |
6386 |
15 Sep 21 |
nicklas |
30 |
{ |
6386 |
15 Sep 21 |
nicklas |
31 |
return p.matcher(f.getName()).matches(); |
6386 |
15 Sep 21 |
nicklas |
32 |
} |
6386 |
15 Sep 21 |
nicklas |
33 |
|
6386 |
15 Sep 21 |
nicklas |
34 |
} |