public static class MultipleParentClassLoader.Builder extends Object
MultipleParentClassLoader
only if multiple or no
ClassLoader
s are found in the process. If exactly a single class loader is found,
this class loader is returned. All class loaders are applied in their collection order with the exception
of the bootstrap class loader which is represented by null
and which is an implicit parent of any
class loader.Modifier and Type | Class and Description |
---|---|
protected static class |
MultipleParentClassLoader.Builder.ClassLoaderCreationAction
A privileged action for creating a multiple-parent class loader.
|
Constructor and Description |
---|
Builder()
Creates a new builder without any class loaders.
|
Modifier and Type | Method and Description |
---|---|
MultipleParentClassLoader.Builder |
append(Class<?>... type)
Appends the class loaders of the given types.
|
MultipleParentClassLoader.Builder |
append(ClassLoader... classLoader)
Appends the given class loaders if they were not yet collected.
|
MultipleParentClassLoader.Builder |
append(Collection<? extends Class<?>> types)
Appends the class loaders of the given types if those class loaders were not yet collected.
|
MultipleParentClassLoader.Builder |
append(List<? extends ClassLoader> classLoaders)
Appends the given class loaders if they were not yet appended.
|
ClassLoader |
build()
Returns an appropriate class loader that represents all the collected class loaders using the current access control context.
|
ClassLoader |
build(AccessControlContext accessControlContext)
Returns the only class loader that was appended if exactly one class loader was appended or a multiple parent class loader as
a parent of all supplied class loader and with the bootstrap class loader as an implicit parent.
|
boolean |
equals(Object other) |
MultipleParentClassLoader.Builder |
filter(ElementMatcher<? super ClassLoader> matcher)
Only retains all class loaders that match the given matcher.
|
int |
hashCode() |
String |
toString() |
public MultipleParentClassLoader.Builder append(Class<?>... type)
type
- The types of which to collect the class loaders.public MultipleParentClassLoader.Builder append(Collection<? extends Class<?>> types)
types
- The types of which to collect the class loaders.public MultipleParentClassLoader.Builder append(ClassLoader... classLoader)
classLoader
- The class loaders to be collected.public MultipleParentClassLoader.Builder append(List<? extends ClassLoader> classLoaders)
classLoaders
- The class loaders to collected.public MultipleParentClassLoader.Builder filter(ElementMatcher<? super ClassLoader> matcher)
matcher
- The matcher to be used for filtering.public ClassLoader build()
public ClassLoader build(AccessControlContext accessControlContext)
accessControlContext
- The access control context to be used for creating the class loader.Copyright © 2014–2016. All rights reserved.