org.apache.shale.tiger.view.faces
Class PackageInfo

java.lang.Object
  extended by org.apache.shale.tiger.view.faces.PackageInfo

public final class PackageInfo
extends Object

Utility class with methods that support getting a recursive list of classes starting with a specific package name.


Constructor Summary
PackageInfo()
           
 
Method Summary
protected  String filenameToClassname(String entryName)
          Convert a filename to a classname.
 Class[] getClasses(List<Class> classes, String pckgname)
          Return an array of all classes, visible to our application class loader, in the specified Java package.
static PackageInfo getInstance()
          Get the singleton instance of this class.
protected  void listFilesRecursive(List<Class> classes, File base, ClassLoader cld, String pckgname)
          Traverse a directory structure starting at base, adding matching files to the specified list.
protected  void loadClass(List<Class> classes, ClassLoader cld, String className)
          Load the class className using the classloader cld, and add it to the list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PackageInfo

public PackageInfo()
Method Detail

getInstance

public static final PackageInfo getInstance()

Get the singleton instance of this class.


getClasses

public Class[] getClasses(List<Class> classes,
                          String pckgname)
                   throws ClassNotFoundException

Return an array of all classes, visible to our application class loader, in the specified Java package.

Parameters:
classes - List of matching classes being accumulated
pckgname - Package name used to select matching classes
Throws:
ClassNotFoundException

filenameToClassname

protected String filenameToClassname(String entryName)

Convert a filename to a classname.

Parameters:
entryName - Filename to be converted

loadClass

protected void loadClass(List<Class> classes,
                         ClassLoader cld,
                         String className)

Load the class className using the classloader cld, and add it to the list.

Parameters:
classes - List of matching classes being accumulated
cld - ClassLoader from which to load the specified class
className - Name of the class to be loaded

listFilesRecursive

protected void listFilesRecursive(List<Class> classes,
                                  File base,
                                  ClassLoader cld,
                                  String pckgname)

Traverse a directory structure starting at base, adding matching files to the specified list.

Parameters:
classes - List of matching classes being accumulated
base - Base file from which to recurse
cld - ClassLoader being searched for matching classes
pckgname - Package name used to select matching classes


Copyright © 2004-2007 Apache Software Foundation. All Rights Reserved.