Class ClassWorld
java.lang.Object
org.codehaus.plexus.classworlds.ClassWorld
- All Implemented Interfaces:
Closeable,AutoCloseable
- Direct Known Subclasses:
ClassWorldReverseAdapter
A collection of
ClassRealms, indexed by id.- Author:
- bob mcwhirter
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(ClassWorldListener listener) voidclose()Closes all contained class realms.voiddisposeRealm(String id) getClassRealm(String id) newRealm(String id, ClassLoader classLoader) newRealm(String id, ClassLoader classLoader, Predicate<String> filter) Adds a class realm with filtering.voidremoveListener(ClassWorldListener listener)
-
Constructor Details
-
ClassWorld
-
ClassWorld
public ClassWorld()
-
-
Method Details
-
newRealm
- Throws:
DuplicateRealmException
-
newRealm
- Throws:
DuplicateRealmException
-
newRealm
public ClassRealm newRealm(String id, ClassLoader classLoader, Predicate<String> filter) throws DuplicateRealmException Adds a class realm with filtering. Only resources/classes whose name matches a given predicate are exposed.- Parameters:
id- The identifier for this realm, must not benull.classLoader- The base class loader for this realm, may benullto use the bootstrap class loader.filter- a predicate to apply to each resource name to determine if it should be loaded through this class loader- Returns:
- the created class realm
- Throws:
DuplicateRealmException- in case a realm with the given id does already exist- Since:
- 2.7.0
- See Also:
-
close
Closes all contained class realms.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException- Since:
- 2.7.0
-
disposeRealm
- Throws:
NoSuchRealmException
-
getRealm
- Throws:
NoSuchRealmException
-
getRealms
-
getClassRealm
-
addListener
-
removeListener
-