Top Description Fields Constructors Methods
org.springframework.core

public abstract Class DecoratingClassLoader

extends ClassLoader
Class Inheritance
Known Direct Subclasses
org.springframework.core.OverridingClassLoader
Imports
java.util.Collections, .Set, java.util.concurrent.ConcurrentHashMap, org.springframework.lang.Nullable, org.springframework.util.Assert

Base class for decorating ClassLoaders such as OverridingClassLoader and org.springframework.instrument.classloading.ShadowingClassLoader, providing common handling of excluded packages and classes.
Authors
Juergen Hoeller, Rod Johnson
Since
2.5.2

Field Summary

Modifier and TypeField and Description
private final Set<String>
private final Set<String>

Constructor Summary

AccessConstructor and Description
public
DecoratingClassLoader()

Create a new DecoratingClassLoader with no parent ClassLoader.

public
DecoratingClassLoader(ClassLoader parent)

Create a new DecoratingClassLoader using the given parent ClassLoader for delegation.

Method Summary

Modifier and TypeMethod and Description
public void
excludeClass(String
the class name to exclude
className
)

Add a class name to exclude from decoration (e.g. overriding).

public void
excludePackage(String
the package name to exclude
packageName
)

Add a package name to exclude from decoration (e.g. overriding).

protected boolean

Returns:

whether the specified class is eligible
isExcluded
(String
the class name to check
className
)

Determine whether the specified class is excluded from decoration by this class loader.

Inherited from java.lang.ClassLoader:
clearAssertionStatusdefineClassdefineClassdefineClassdefineClassdefinePackagefindClassfindClassfindLibraryfindLoadedClassfindResourcefindResourcefindResourcesfindSystemClassgetClassLoadingLockgetDefinedPackagegetDefinedPackagesgetNamegetPackagegetPackagesgetParentgetPlatformClassLoadergetResourcegetResourceAsStreamgetResourcesgetSystemClassLoadergetSystemResourcegetSystemResourceAsStreamgetSystemResourcesgetUnnamedModuleisRegisteredAsParallelCapableloadClassloadClassregisterAsParallelCapableresolveClassresourcessetClassAssertionStatussetDefaultAssertionStatussetPackageAssertionStatussetSigners

Field Detail

excludedClassesback to summary
private final Set<String> excludedClasses
excludedPackagesback to summary
private final Set<String> excludedPackages

Constructor Detail

DecoratingClassLoaderback to summary
public DecoratingClassLoader()

Create a new DecoratingClassLoader with no parent ClassLoader.

DecoratingClassLoaderback to summary
public DecoratingClassLoader(ClassLoader parent)

Create a new DecoratingClassLoader using the given parent ClassLoader for delegation.

Method Detail

excludeClassback to summary
public void excludeClass(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:String

the class name to exclude

excludePackageback to summary
public void excludePackage(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:String

the package name to exclude

isExcludedback to summary
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:String

the class name to check

Returns:boolean

whether the specified class is eligible

See Also
excludePackage, excludeClass