Package org.codehaus.plexus.classworlds
Class ClassWorld
java.lang.Object
org.codehaus.plexus.classworlds.ClassWorld
- All Implemented Interfaces:
Closeable
,AutoCloseable
- Direct Known Subclasses:
ClassWorldReverseAdapter
A collection of
ClassRealm
s, indexed by id.- Author:
- bob mcwhirter
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(ClassWorldListener listener) void
close()
Closes all contained class realms.void
disposeRealm
(String id) getClassRealm
(String id) newRealm
(String id, ClassLoader classLoader) newRealm
(String id, ClassLoader classLoader, Predicate<String> filter) Adds a class realm with filtering.void
removeListener
(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 benull
to 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:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
- Since:
- 2.7.0
-
disposeRealm
- Throws:
NoSuchRealmException
-
getRealm
- Throws:
NoSuchRealmException
-
getRealms
-
getClassRealm
-
addListener
-
removeListener
-