ch.elca.el4j.services.persistence.hibernate.entityfinder
Class ClassLocator

java.lang.Object
  extended by ch.elca.el4j.services.persistence.hibernate.entityfinder.ClassLocator

public class ClassLocator
extends Object

Utility to locate classes from the classpath.

File-location:
ClassLocator
Last check-in date:
2009-08-04 13:59:45 +0200 (Di, 04. Aug 2009) by swismer for revision 3873

Field Summary
protected  ClassLoader classLoader
          Is the used classloader to lookup classes.
protected  String[] packageNames
          Are the package names the found classes' package must start with.
 
Constructor Summary
ClassLocator(ClassLoader classLoader, String... packageNames)
          Locates all classes that are in one of the given packages (inclusive sub-packages).
ClassLocator(String... packageNames)
          Locates all classes that are in one of the given packages (inclusive sub-packages).
 
Method Summary
 List<ClassLocation> getAllClassLocations()
          Returns all located classes where the found classes' package starts with one of the given package names.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

packageNames

protected final String[] packageNames
Are the package names the found classes' package must start with.


classLoader

protected final ClassLoader classLoader
Is the used classloader to lookup classes.

Constructor Detail

ClassLocator

public ClassLocator(String... packageNames)
             throws ClassNotFoundException
Locates all classes that are in one of the given packages (inclusive sub-packages).

Parameters:
packageNames - Are the package names the found classes' package must start with.
Throws:
ClassNotFoundException - If the context classloader of the current thread could not be fetched.

ClassLocator

public ClassLocator(ClassLoader classLoader,
                    String... packageNames)
Locates all classes that are in one of the given packages (inclusive sub-packages).

Parameters:
classLoader - Is the used classloader to lookup classes.
packageNames - Are the package names the found classes' package must start with.
Method Detail

getAllClassLocations

public List<ClassLocation> getAllClassLocations()
                                         throws ClassNotFoundException,
                                                IOException
Returns all located classes where the found classes' package starts with one of the given package names.

Returns:
Returns the found class locations.
Throws:
ClassNotFoundException - If no class could be found for one of the given packages.
IOException - If there was a general IO problem.


Copyright © 2005-2011 ELCA. All Rights Reserved.