net.sf.mmm.util.reflect.base
Class ClassNameCollector

java.lang.Object
  extended by net.sf.mmm.util.reflect.base.ClassNameCollector
All Implemented Interfaces:
ResourceVisitor

public class ClassNameCollector
extends Object
implements ResourceVisitor

This is an implementation of the ResourceVisitor interface that collects the names of all classes accepted by a given filter in a Set.

Since:
1.1.0
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)

Field Summary
private  Set<String> classNameSet
          Set to collect class-names.
private  Filter<String> filter
          Filter to accept class-names.
private static String SUFFIX_CLASS
          Suffix for classes as resource.
 
Constructor Summary
ClassNameCollector(Set<String> classNameSet, Filter<String> filter)
          The constructor.
 
Method Summary
 boolean visitPackage(String classpath)
          This method is invoked for each traversed package.
 void visitResource(String classpath)
          This method is invoked for each resource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SUFFIX_CLASS

private static final String SUFFIX_CLASS
Suffix for classes as resource.

See Also:
Constant Field Values

classNameSet

private final Set<String> classNameSet
Set to collect class-names.


filter

private final Filter<String> filter
Filter to accept class-names.

Constructor Detail

ClassNameCollector

public ClassNameCollector(Set<String> classNameSet,
                          Filter<String> filter)
The constructor.

Parameters:
classNameSet - is the Set where collected Class-names will be added.
filter - is used to filter classes by name.
Method Detail

visitPackage

public boolean visitPackage(String classpath)
This method is invoked for each traversed package.

Specified by:
visitPackage in interface ResourceVisitor
Parameters:
classpath - is the absolute classpath of the traversed package (e.g. "net/sf/mmm/util/reflect").
Returns:
true if the package should be traversed recursively, false if the package and all its content (including sub-packages) should be skipped.

visitResource

public void visitResource(String classpath)
This method is invoked for each resource.

Specified by:
visitResource in interface ResourceVisitor
Parameters:
classpath - is the absolute classpath of the resource (e.g. "net/sf/mmm/util/reflect/api/ReflectionUtil.class" or "net/sf/mmm/util/reflect/beans-reflect.xml").


Copyright © 2001-2010 mmm-Team. All Rights Reserved.