18 package org.turro.file;
21 import java.io.FileFilter;
22 import org.zkoss.lang.Strings;
30 private boolean fullPath =
false, partial =
true,
31 acceptOnNull =
true, regularExpression =
false;
32 private String expression;
35 public boolean accept(File pathname) {
36 if(expression ==
null) {
39 String name = fullPath ? pathname.getAbsolutePath() : pathname.getName();
40 String regExp = expression;
41 if(!regularExpression) {
42 regExp = regExp.replaceAll(
"\\*",
".*")
43 .replaceAll(
"\\?",
".?");
46 regExp =
".*" + regExp +
".*";
48 return name.matches(regExp);
52 return Strings.isEmpty(expression);
60 this.acceptOnNull = acceptOnNull;
68 this.expression = expression;
76 this.fullPath = fullPath;
84 this.partial = partial;
88 return regularExpression;
92 this.regularExpression = regularExpression;
void setRegularExpression(boolean regularExpression)
void setPartial(boolean partial)
boolean isRegularExpression()
void setExpression(String expression)
void setAcceptOnNull(boolean acceptOnNull)
void setFullPath(boolean fullPath)
boolean accept(File pathname)