org.equanda.util
Class ReflectionUtil

java.lang.Object
  extended by org.equanda.util.ReflectionUtil

public final class ReflectionUtil
extends Object

based on the ReflectionUtil class in m-m-m

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

Field Summary
static ReflectionUtil INSTANCE
          This is the singleton instance of this ReflectionUtil.
 
Method Summary
 Set<String> findClassNames(String packageName, boolean includeSubPackages)
          This method finds all classes that are located in the package identified by the given packageName.
 void findClassNames(String packageName, boolean includeSubPackages, Set<String> classSet)
          This method finds all classes that are located in the package identified by the given packageName.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final ReflectionUtil INSTANCE
This is the singleton instance of this ReflectionUtil. Instead of declaring the methods static, we declare this static instance what gives the same way of access while still allowing a design for extension by inheriting from this class.

Method Detail

findClassNames

public Set<String> findClassNames(String packageName,
                                  boolean includeSubPackages)
                           throws IOException
This method finds all classes that are located in the package identified by the given packageName.
ATTENTION:
This is a relative expensive operation. Depending on your classpath multiple directories,JAR-, and WAR-files may need to be scanned.

Parameters:
packageName - is the name of the Package to scan.
includeSubPackages - - if true all sub-packages of the specified Package will be included in the search.
Returns:
a Set will the fully qualified names of all requested classes.
Throws:
IOException - if the operation failed with an I/O error.

findClassNames

public void findClassNames(String packageName,
                           boolean includeSubPackages,
                           Set<String> classSet)
                    throws IOException
This method finds all classes that are located in the package identified by the given packageName.
ATTENTION:
This is a relative expensive operation. Depending on your classpath multiple directories,JAR-, and WAR-files may need to be scanned.

Parameters:
packageName - is the name of the Package to scan.
includeSubPackages - - if true all sub-packages of the specified Package will be included in the search.
classSet - is where to add the classes.
Throws:
IOException - if the operation failed with an I/O error.


Copyright © 2007-2009. All Rights Reserved.