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

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

public class ResourceNameCollector
extends Object
implements ResourceVisitor

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

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

Field Summary
private  Filter<String> filter
          Filter to accept resource-names.
private  Set<String> resourceSet
          Set to collect resource-names.
 
Constructor Summary
ResourceNameCollector(Set<String> resourceSet, 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

resourceSet

private final Set<String> resourceSet
Set to collect resource-names.


filter

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

Constructor Detail

ResourceNameCollector

public ResourceNameCollector(Set<String> resourceSet,
                             Filter<String> filter)
The constructor.

Parameters:
resourceSet - is the Set where collected resource-names will be added.
filter - is used to filter resources 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.