net.sf.clirr.core
Class ClassSelector

java.lang.Object
  extended by net.sf.clirr.core.ClassSelector
All Implemented Interfaces:
ClassFilter

public final class ClassSelector
extends java.lang.Object
implements ClassFilter

Given a JavaClass object, determines whether or not it is "selected", based on its class or package. This is used to select subsets of the classes available in a classpath for comparison or testing purposes.

Author:
Simon Kitching

Nested Class Summary
static class ClassSelector.Mode
          Class for implementing an enumeration.
 
Field Summary
static ClassSelector.Mode MODE_IF
          positive selection.
static ClassSelector.Mode MODE_UNLESS
          negative selection.
 
Constructor Summary
ClassSelector(ClassSelector.Mode mode)
          Create a selector.
 
Method Summary
 void addClass(java.lang.String classname)
          Matches the class with exactly this name, plus any of its inner classes.
 void addPackage(java.lang.String packageName)
          Matches any class which is in the named package.
 void addPackageTree(java.lang.String packageName)
          Matches any class which is in the named package or any subpackage of it.
 boolean isSelected(org.apache.bcel.classfile.JavaClass clazz)
          Return true if this class is one selected by the criteria stored in this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MODE_IF

public static final ClassSelector.Mode MODE_IF
positive selection.


MODE_UNLESS

public static final ClassSelector.Mode MODE_UNLESS
negative selection.

Constructor Detail

ClassSelector

public ClassSelector(ClassSelector.Mode mode)
Create a selector.

When mode is MODE_IF then a class is "selected" if-and-only-if the class matches one of the criteria defined via the addXXX methods. In other words, the criteria specify which classes are included (selected) in the resulting class set.

When mode is MODE_UNLESS, then a class is "selected" unless the class matches one of the criteria defined via the addXXX methods. In other words, the criteria specify which classes are excluded from the resulting class set.

Method Detail

addPackage

public void addPackage(java.lang.String packageName)
Matches any class which is in the named package.


addPackageTree

public void addPackageTree(java.lang.String packageName)
Matches any class which is in the named package or any subpackage of it.


addClass

public void addClass(java.lang.String classname)
Matches the class with exactly this name, plus any of its inner classes.


isSelected

public boolean isSelected(org.apache.bcel.classfile.JavaClass clazz)
Return true if this class is one selected by the criteria stored in this object.

Specified by:
isSelected in interface ClassFilter
Parameters:
clazz - a Java class
Returns:
true if clazz should be considered by the Checker in this object.


Copyright © 2003-2005 Lars Kühne. All Rights Reserved.