ClassnameFilterpublic class ClassnameFilter extends Object implements FilenameFilter
Fields Summary |
---|
boolean | includeAll | boolean | conditional | Hashtable | includedClass | Hashtable | includedPackage |
Constructors Summary |
---|
public ClassnameFilter(boolean conditional) // string package names
this.conditional = conditional;
| public ClassnameFilter()
this(false);
|
Methods Summary |
---|
public boolean | accept(java.io.File dir, java.lang.String className)
if ( includedClass.get( className ) != null ){
return true;
} else if (includeAll) {
return true;
} else {
String pkgName = className;
int pkgLength = className.lastIndexOf('/");
// look at immediate package, and superpackage, and ...
while ( pkgLength > 0 ){
pkgName = pkgName.substring( 0, pkgLength );
if ( includedPackage.get( pkgName ) != null ){
return true;
}
pkgLength = pkgName.lastIndexOf('/");
}
}
return false;
| public void | includeClass(java.lang.String className)
includedClass.put( className, className );
| public void | includeName(java.lang.String classname)
if ( classname.charAt( classname.length()-1 ) == '*" ){
// this is a package name, not a class name
// strip off trailing junk and put it on the included package
// list.
int pkgLength = classname.lastIndexOf( '/" );
if ( pkgLength < 0 )
includePackage( null );
else
includePackage( classname.substring( 0, pkgLength ) );
} else {
includeClass( classname );
}
| public void | includePackage(java.lang.String packageName)
if ( packageName == null || (packageName.length() == 0 ) )
includeAll = true;
else
includedPackage.put( packageName, packageName );
|
|