org.clapper.util.classutil
Class SubclassClassFilter

java.lang.Object
  extended by org.clapper.util.classutil.SubclassClassFilter
All Implemented Interfaces:
ClassFilter

public class SubclassClassFilter
extends java.lang.Object
implements ClassFilter

SubclassClassFilter is a ClassFilter that matches class names that (a) can be loaded and (b) extend a given subclass or implement a specified interface, directly or indirectly. It uses the java.lang.Class.isAssignableFrom()

method, so it actually has to load each class it tests. For maximum flexibility, a SubclassClassFilter can be configured to use a specific class loader.

Version:
$Revision: 6735 $
Author:
Copyright © 2006 Brian M. Clapper

Constructor Summary
SubclassClassFilter(java.lang.Class baseClassOrInterface)
          Construct a new SubclassClassFilter that will accept only classes that extend the specified class or implement the specified interface.
 
Method Summary
 boolean accept(ClassInfo classInfo, ClassFinder classFinder)
          Perform the acceptance test on the loaded Class object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SubclassClassFilter

public SubclassClassFilter(java.lang.Class baseClassOrInterface)
Construct a new SubclassClassFilter that will accept only classes that extend the specified class or implement the specified interface.

Parameters:
baseClassOrInterface - the base class or interface
Method Detail

accept

public boolean accept(ClassInfo classInfo,
                      ClassFinder classFinder)
Perform the acceptance test on the loaded Class object.

Specified by:
accept in interface ClassFilter
Parameters:
classInfo - the ClassInfo object to test
classFinder - the invoking ClassFinder object
Returns:
true if the class name matches, false if it doesn't


Copyright © 2004-2007 Brian M. Clapper. All Rights Reserved.