org.springframework.core
Class DecoratingClassLoader

java.lang.Object
  extended by java.lang.ClassLoader
      extended by org.springframework.core.DecoratingClassLoader
Direct Known Subclasses:
ContextTypeMatchClassLoader, OverridingClassLoader, ShadowingClassLoader

public abstract class DecoratingClassLoader
extends java.lang.ClassLoader

Base class for decorating ClassLoaders such as OverridingClassLoader and ShadowingClassLoader, providing common handling of excluded packages and classes.

Since:
2.5.2
Author:
Juergen Hoeller, Rod Johnson

Field Summary
private  java.util.Set<java.lang.String> excludedClasses
           
private  java.util.Set<java.lang.String> excludedPackages
           
private  java.lang.Object exclusionMonitor
           
 
Constructor Summary
DecoratingClassLoader()
          Create a new DecoratingClassLoader with no parent ClassLoader.
DecoratingClassLoader(java.lang.ClassLoader parent)
          Create a new DecoratingClassLoader using the given parent ClassLoader for delegation.
 
Method Summary
 void excludeClass(java.lang.String className)
          Add a class name to exclude from decoration (e.g.
 void excludePackage(java.lang.String packageName)
          Add a package name to exclude from decoration (e.g.
protected  boolean isExcluded(java.lang.String className)
          Determine whether the specified class is excluded from decoration by this class loader.
 
Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findResources, findSystemClass, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

excludedPackages

private final java.util.Set<java.lang.String> excludedPackages

excludedClasses

private final java.util.Set<java.lang.String> excludedClasses

exclusionMonitor

private final java.lang.Object exclusionMonitor
Constructor Detail

DecoratingClassLoader

public DecoratingClassLoader()
Create a new DecoratingClassLoader with no parent ClassLoader.


DecoratingClassLoader

public DecoratingClassLoader(java.lang.ClassLoader parent)
Create a new DecoratingClassLoader using the given parent ClassLoader for delegation.

Method Detail

excludePackage

public void excludePackage(java.lang.String packageName)
Add a package name to exclude from decoration (e.g. overriding).

Any class whose fully-qualified name starts with the name registered here will be handled by the parent ClassLoader in the usual fashion.

Parameters:
packageName - the package name to exclude

excludeClass

public void excludeClass(java.lang.String className)
Add a class name to exclude from decoration (e.g. overriding).

Any class name registered here will be handled by the parent ClassLoader in the usual fashion.

Parameters:
className - the class name to exclude

isExcluded

protected boolean isExcluded(java.lang.String className)
Determine whether the specified class is excluded from decoration by this class loader.

The default implementation checks against excluded packages and classes.

Parameters:
className - the class name to check
Returns:
whether the specified class is eligible
See Also:
excludePackage(java.lang.String), excludeClass(java.lang.String)