Facemorph.psychomorph
Class ClasspathInspector

java.lang.Object
  extended by Facemorph.psychomorph.ClasspathInspector

public class ClasspathInspector
extends java.lang.Object

Find classes in the classpath (reads JARs and classpath folders).


Constructor Summary
ClasspathInspector()
           
 
Method Summary
static java.util.List<java.lang.Class> getAllKnownClasses()
          List all the classes known by the system
static java.util.List<java.io.File> getClassLocationsForCurrentClasspath()
          Gets the class locations for the current classpath
static java.util.List<java.lang.Class> getMatchingClasses(java.lang.Class interfaceOrSuperclass)
          Get classes matching the interface or super class
static java.util.List<java.lang.Class> getMatchingClasses(java.lang.Class interfaceOrSuperclass, java.io.File file)
          Get classes matching the interface or super class
static java.util.List<java.lang.Class> getMatchingClasses(java.lang.Class interfaceOrSuperclass, java.net.URL url)
          Get classes matching the interface or super class
static java.net.URL normalize(java.net.URL url)
          Try to normalise a URL
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClasspathInspector

public ClasspathInspector()
Method Detail

getAllKnownClasses

public static java.util.List<java.lang.Class> getAllKnownClasses()
                                                          throws java.net.MalformedURLException
List all the classes known by the system

Returns:
return a list of the classes
Throws:
java.net.MalformedURLException

getMatchingClasses

public static java.util.List<java.lang.Class> getMatchingClasses(java.lang.Class interfaceOrSuperclass)
                                                          throws java.net.MalformedURLException
Get classes matching the interface or super class

Parameters:
interfaceOrSuperclass - the class / interface to match to
Returns:
return the list of match classes from the current classpath
Throws:
java.net.MalformedURLException

getMatchingClasses

public static java.util.List<java.lang.Class> getMatchingClasses(java.lang.Class interfaceOrSuperclass,
                                                                 java.io.File file)
                                                          throws java.net.MalformedURLException
Get classes matching the interface or super class

Parameters:
interfaceOrSuperclass - the class / interface to match to
file - file or jar file to search for matching classes in
Returns:
return the list of match classes from the current classpath
Throws:
java.net.MalformedURLException

getMatchingClasses

public static java.util.List<java.lang.Class> getMatchingClasses(java.lang.Class interfaceOrSuperclass,
                                                                 java.net.URL url)
                                                          throws java.net.MalformedURLException
Get classes matching the interface or super class

Parameters:
interfaceOrSuperclass - the class / interface to match to
file - file or jar file to search for matching classes in
Returns:
return the list of match classes from the current classpath
Throws:
java.net.MalformedURLException

getClassLocationsForCurrentClasspath

public static java.util.List<java.io.File> getClassLocationsForCurrentClasspath()
Gets the class locations for the current classpath

Returns:
returns the locations as a list of files

normalize

public static java.net.URL normalize(java.net.URL url)
                              throws java.net.MalformedURLException
Try to normalise a URL

Parameters:
url - the URL to normalise
Returns:
returns the normalised URL
Throws:
java.net.MalformedURLException