org.basex.build.fs.parser
Class Loader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by org.basex.build.fs.parser.Loader

public final class Loader
extends java.lang.ClassLoader

Some utility methods for loading class files from folders, packages or jar files.

Author:
Workgroup DBIS, University of Konstanz 2005-09, ISC License, Bastian Lemke

Method Summary
static java.lang.Class<?>[] load(java.lang.Package pkg, java.lang.Class<?> superClass)
           Load all subclasses of superClass from the package pkg.
static java.lang.Class<?>[] load(java.lang.Package pkg, java.util.regex.Pattern fileNamePat)
           Load some classes from a package that is on the classpath.
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

load

public static java.lang.Class<?>[] load(java.lang.Package pkg,
                                        java.lang.Class<?> superClass)
                                 throws java.io.IOException

Load all subclasses of superClass from the package pkg. The classes may either be in a directory or inside a java archive file. If one of the classes is already loaded, nothing is done (but the class will be included in the results).

superClass may be an abstract class, an interface or a regular class. Every class inside the package pkg that implements the interface or extends the class is loaded.

This method breaks after the first error. Subsequent classes are not loaded.

Parameters:
pkg - the package to load the classes from.
superClass - either the interface that has to be implemented by the classes or a class that has to be extended.
Returns:
an array with all the loaded classes.
Throws:
java.io.IOException - if the classes are located inside a JAR file and any error occurs while reading from this file.

load

public static java.lang.Class<?>[] load(java.lang.Package pkg,
                                        java.util.regex.Pattern fileNamePat)
                                 throws java.io.IOException

Load some classes from a package that is on the classpath. The classes may either be in a directory or inside a java archive file. If one of the classes is already loaded, nothing is done (but the class will be included in the results).

This method breaks after the first error. Subsequent classes are not loaded.

Parameters:
pkg - the package to load the classes from.
fileNamePat - the pattern used for matching the class names.
Returns:
an array with all the loaded classes.
Throws:
java.io.IOException - if the classes are located inside a JAR file and any error occurs while reading from this file.