jfun.jaskell.classloader
Class ClassLoaderFactory

java.lang.Object
  extended by jfun.jaskell.classloader.ClassLoaderFactory

public final class ClassLoaderFactory
extends java.lang.Object

A factory class that creates ClassLoader object.

Zephyr Business Solution

Author:
Ben Yu

Nested Class Summary
static interface ClassLoaderFactory.ErrorHandler
          To handle errors during class loading.
 
Field Summary
static java.lang.String CHILD_FIRST
          The child-first string value.
static java.lang.String CHILD_ONLY
          The child-only string value.
static java.lang.String PARENT_FIRST
          The parent-first string value.
static java.lang.String PARENT_ONLY
          The parent-only string value.
 
Constructor Summary
ClassLoaderFactory(java.io.File basedir, ClassLoaderFactory.ErrorHandler handler, java.lang.String policy)
          Creates a ClassLoaderFactory object.
 
Method Summary
 void addSysPackage(java.lang.String prefix)
           
 java.lang.ClassLoader createClassLoader(java.lang.ClassLoader parent, java.lang.Object path)
          Create a ClassLoader object by using the current ClassLoader policy and the given class path.
 java.lang.ClassLoader createClassLoader(java.lang.Object path)
          Create a ClassLoader object by using the current ClassLoader policy and the given class path.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARENT_FIRST

public static final java.lang.String PARENT_FIRST
The parent-first string value.

See Also:
Constant Field Values

CHILD_FIRST

public static final java.lang.String CHILD_FIRST
The child-first string value.

See Also:
Constant Field Values

PARENT_ONLY

public static final java.lang.String PARENT_ONLY
The parent-only string value.

See Also:
Constant Field Values

CHILD_ONLY

public static final java.lang.String CHILD_ONLY
The child-only string value.

See Also:
Constant Field Values
Constructor Detail

ClassLoaderFactory

public ClassLoaderFactory(java.io.File basedir,
                          ClassLoaderFactory.ErrorHandler handler,
                          java.lang.String policy)
                   throws java.lang.IllegalArgumentException
Creates a ClassLoaderFactory object.

Parameters:
basedir - the base directory.
handler - the handler object that handles class loading problems.
policy - the class loader policy.
Throws:
java.lang.IllegalArgumentException - when the policy is not a valid string.
Method Detail

createClassLoader

public java.lang.ClassLoader createClassLoader(java.lang.Object path)
Create a ClassLoader object by using the current ClassLoader policy and the given class path.

Parameters:
path - the class path. This can be either a String, a File, or a list of paths.
Returns:
the ClassLoader object.

createClassLoader

public java.lang.ClassLoader createClassLoader(java.lang.ClassLoader parent,
                                               java.lang.Object path)
Create a ClassLoader object by using the current ClassLoader policy and the given class path.

Parameters:
parent - the parent ClassLoader object.
path - the class path. This can be either a String, a File, or a list of paths.
Returns:
the ClassLoader object.

addSysPackage

public void addSysPackage(java.lang.String prefix)