Package org.springframework.core

# Class DecoratingClassLoader

java.lang.Object
java.lang.ClassLoader
org.springframework.core.DecoratingClassLoader

Direct Known Subclasses:
  `OverridingClassLoader`

public abstract class DecoratingClassLoader extends ClassLoader
Base class for decorating ClassLoaders such as `OverridingClassLoader` and `org.springframework.instrument.classloading.ShadowingClassLoader`, providing common handling of excluded packages and classes.

Since:
  2.5.2
Author:
  Juergen Hoeller, Rod Johnson

## Constructor Summary

Constructors
Constructor
Description
`DecoratingClassLoader()`
Create a new DecoratingClassLoader with no parent ClassLoader.
`DecoratingClassLoader(ClassLoader parent)`
Create a new DecoratingClassLoader using the given parent ClassLoader for delegation.

## Method Summary

Modifier and Type
Method
Description
`void`
`excludeClass(String className)`
Add a class name to exclude from decoration (for example, overriding).
`void`
`excludePackage(String packageName)`
Add a package name to exclude from decoration (for example, overriding).
`protected boolean`
`isExcluded(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, findClass, findLibrary, findLoadedClass, findResource, findResource, findResources, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### DecoratingClassLoader

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

### DecoratingClassLoader

public DecoratingClassLoader(@Nullable ClassLoader parent)
Create a new DecoratingClassLoader using the given parent ClassLoader for delegation.

## Method Details

### excludePackage

public void excludePackage(String packageName)
Add a package name to exclude from decoration (for example, 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(String className)
Add a class name to exclude from decoration (for example, 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(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)`