org.clapper.util.classutil
Class ClassModifiersClassFilter

java.lang.Object
  extended by org.clapper.util.classutil.ClassModifiersClassFilter
All Implemented Interfaces:
ClassFilter
Direct Known Subclasses:
AbstractClassFilter, InterfaceOnlyClassFilter

public class ClassModifiersClassFilter
extends java.lang.Object
implements ClassFilter

ClassModifiersClassFilter is a ClassFilter that matches class names that (a) can be loaded and (b) match a set of class modifiers (as defined by the constants in the java.lang.reflect.Modifier class). For instance, the the following code fragment defines a filter that will match only public final classes:

 import java.lang.reflect.Modifier;

 ...

 ClassFilter = new ClassModifiersClassFilter (Modifier.PUBLIC | Modifier.FINAL);
 

This class relies on the pool of classes read by a ClassFinder; it's not really useful by itself.

Version:
$Revision: 6735 $
Author:
Copyright © 2006 Brian M. Clapper
See Also:
ClassFilter, ClassFinder, Modifier

Constructor Summary
ClassModifiersClassFilter(int modifiers)
          Construct a new ClassModifiersClassFilter that will accept any classes with the specified modifiers.
 
Method Summary
 boolean accept(ClassInfo classInfo, ClassFinder classFinder)
          Tests whether a class name should be included in a class name list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassModifiersClassFilter

public ClassModifiersClassFilter(int modifiers)
Construct a new ClassModifiersClassFilter that will accept any classes with the specified modifiers.

Parameters:
modifiers - the bit-field of modifier flags. See the java.lang.reflect.Modifier class for legal values.
Method Detail

accept

public boolean accept(ClassInfo classInfo,
                      ClassFinder classFinder)
Tests whether a class name should be included in a class name list.

Specified by:
accept in interface ClassFilter
Parameters:
classInfo - the loaded information about the class
classFinder - the ClassFinder that called this filter (mostly for access to ClassFinder utility methods)
Returns:
true if and only if the name should be included in the list; false otherwise


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